You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2011/05/08 14:46:21 UTC

svn commit: r1100726 - /subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh

Author: danielsh
Date: Sun May  8 12:46:20 2011
New Revision: 1100726

URL: http://svn.apache.org/viewvc?rev=1100726&view=rev
Log:
More portability fixes.  Drop xargs and don't depend on seq(1).

* tools/dev/benchmarks/large_dirs/create_bigdir.sh
  (get_sequence): New wrapper around jot/seq/python.
  (main loop): Use it instead of seq and xargs.

Modified:
    subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh

Modified: subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh?rev=1100726&r1=1100725&r2=1100726&view=diff
==============================================================================
--- subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh (original)
+++ subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh Sun May  8 12:46:20 2011
@@ -99,6 +99,13 @@ echo
 rm -rf $WC
 ${SVN} co $URL $WC > /dev/null
 
+# helpers
+
+get_sequence() {
+  # three equivalents...
+  (jot - "$1" "$2" "1" 2>/dev/null || seq -s ' ' "$1" "$2" 2>/dev/null || python -c "for i in range($1,$2+1): print i")
+}
+
 # functions that execute an SVN command
 
 run_svn() {
@@ -146,9 +153,10 @@ run_svn_get() {
 while [ $FILECOUNT -lt $MAXCOUNT ]; do
   echo "Processing $FILECOUNT files in the same folder"
 
+  sequence=`get_sequence 2 $FILECOUNT`
   printf "\tCreating files ... \t real   user    sys\n"
   mkdir $WC/$FILECOUNT
-  for i in `seq 1 ${FILECOUNT}`; do
+  for i in 1 $sequence; do
     echo "File number $i" > $WC/$FILECOUNT/$i
   done    
 
@@ -178,7 +186,7 @@ while [ $FILECOUNT -lt $MAXCOUNT ]; do
 
   printf "\tDeleting files ... \t"
   time sh -c "
-  for i in `seq 2 ${FILECOUNT} | xargs`; do
+  for i in $sequence; do
     ${SVN} del $WC/${FILECOUNT}_c/\$i -q
   done "
 



Re: svn commit: r1100726 - /subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Greg Stein wrote on Sun, May 08, 2011 at 20:14:39 -0400:
> On Sun, May 8, 2011 at 08:46,  <da...@apache.org> wrote:
> >...
> > +++ subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh Sun May  8 12:46:20 2011
> > @@ -99,6 +99,13 @@ echo
> >  rm -rf $WC
> >  ${SVN} co $URL $WC > /dev/null
> >
> > +# helpers
> > +
> > +get_sequence() {
> > +  # three equivalents...
> > +  (jot - "$1" "$2" "1" 2>/dev/null || seq -s ' ' "$1" "$2" 2>/dev/null || python -c "for i in range($1,$2+1): print i")
> 
> If you're invoking Python, then I'd recommend just writing the whole
> thing in Python. (tho... I guess some thing are easier in sh...)
> 

I assume C is faster than Python, and this is a benchmark script, so
I went for the unportable-but-faster options where they're available.

> >...
> 
> Cheers,
> -g

Re: svn commit: r1100726 - /subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh

Posted by Greg Stein <gs...@gmail.com>.
On Sun, May 8, 2011 at 08:46,  <da...@apache.org> wrote:
>...
> +++ subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh Sun May  8 12:46:20 2011
> @@ -99,6 +99,13 @@ echo
>  rm -rf $WC
>  ${SVN} co $URL $WC > /dev/null
>
> +# helpers
> +
> +get_sequence() {
> +  # three equivalents...
> +  (jot - "$1" "$2" "1" 2>/dev/null || seq -s ' ' "$1" "$2" 2>/dev/null || python -c "for i in range($1,$2+1): print i")

If you're invoking Python, then I'd recommend just writing the whole
thing in Python. (tho... I guess some thing are easier in sh...)

>...

Cheers,
-g

Re: svn commit: r1100726 - /subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh

Posted by Daniel Shahaf <da...@apache.org>.
Arfrever Frehtes Taifersar Arahesis wrote on Mon, May 09, 2011 at 00:11:13 +0200:
> 2011-05-08 14:46:21 danielsh@apache.org napisał(a):
> > Author: danielsh
> > Date: Sun May  8 12:46:20 2011
> > New Revision: 1100726
> > 
> > URL: http://svn.apache.org/viewvc?rev=1100726&view=rev
> > Log:
> > More portability fixes.  Drop xargs and don't depend on seq(1).
> > 
> > * tools/dev/benchmarks/large_dirs/create_bigdir.sh
> >   (get_sequence): New wrapper around jot/seq/python.
> >   (main loop): Use it instead of seq and xargs.
> > 
> > Modified:
> >     subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh
> > 
> > Modified: subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh
> > URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh?rev=1100726&r1=1100725&r2=1100726&view=diff
> > ==============================================================================
> > --- subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh (original)
> > +++ subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh Sun May  8 12:46:20 2011
> > @@ -99,6 +99,13 @@ echo
> >  rm -rf $WC
> >  ${SVN} co $URL $WC > /dev/null
> >  
> > +# helpers
> > +
> > +get_sequence() {
> > +  # three equivalents...
> > +  (jot - "$1" "$2" "1" 2>/dev/null || seq -s ' ' "$1" "$2" 2>/dev/null || python -c "for i in range($1,$2+1): print i")
> 
> http://www.archlinux.org/news/python-is-now-python-3/
> (I heard that such a change will occur also in Gentoo in 2011.)

And....?   Did python 3 break the syntax I am using here?

Anyway, if it breaks stuff for py3 users, I'd appreciate if some of them
could fix it --- I don't have it installed at the moment.

Re: svn commit: r1100726 - /subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh

Posted by Arfrever Frehtes Taifersar Arahesis <ar...@gmail.com>.
2011-05-08 14:46:21 danielsh@apache.org napisał(a):
> Author: danielsh
> Date: Sun May  8 12:46:20 2011
> New Revision: 1100726
> 
> URL: http://svn.apache.org/viewvc?rev=1100726&view=rev
> Log:
> More portability fixes.  Drop xargs and don't depend on seq(1).
> 
> * tools/dev/benchmarks/large_dirs/create_bigdir.sh
>   (get_sequence): New wrapper around jot/seq/python.
>   (main loop): Use it instead of seq and xargs.
> 
> Modified:
>     subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh
> 
> Modified: subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh
> URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh?rev=1100726&r1=1100725&r2=1100726&view=diff
> ==============================================================================
> --- subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh (original)
> +++ subversion/trunk/tools/dev/benchmarks/large_dirs/create_bigdir.sh Sun May  8 12:46:20 2011
> @@ -99,6 +99,13 @@ echo
>  rm -rf $WC
>  ${SVN} co $URL $WC > /dev/null
>  
> +# helpers
> +
> +get_sequence() {
> +  # three equivalents...
> +  (jot - "$1" "$2" "1" 2>/dev/null || seq -s ' ' "$1" "$2" 2>/dev/null || python -c "for i in range($1,$2+1): print i")

http://www.archlinux.org/news/python-is-now-python-3/
(I heard that such a change will occur also in Gentoo in 2011.)

-- 
Arfrever Frehtes Taifersar Arahesis