in reply to Re: cut vs split (suggestions)
in thread cut vs split (suggestions)
Some of the slowness appears to be related to the split, rather than the join. On my system, this takes about 9s:
and your version takes a little less:$ time perl -lanF, -e 'print join ",", @F[0..14];' numbers.csv > /dev/ +null real 0m9.880s user 0m9.716s sys 0m0.034s
but this one avoiding both -a and join only takes about 3.4s:$ time perl -lanF, -e 'BEGIN{ $,=","} print @F[0..14];' numbers.csv > +/dev/null real 0m8.974s user 0m8.772s sys 0m0.042s
$ time perl -ln -e 'print $1 if /((?:[^,]+,){14}[^,]+)/' numbers.csv > + /dev/null real 0m3.412s user 0m3.370s sys 0m0.031s
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: cut vs split (suggestions)
by BrowserUk (Patriarch) on Apr 17, 2005 at 06:01 UTC | |
by sk (Curate) on Apr 17, 2005 at 07:01 UTC | |
by pijll (Beadle) on Apr 17, 2005 at 07:54 UTC | |
by tlm (Prior) on Apr 17, 2005 at 07:42 UTC | |
Re^3: cut vs split (suggestions)
by tlm (Prior) on Apr 17, 2005 at 06:37 UTC | |
by dave0 (Friar) on Apr 18, 2005 at 13:45 UTC |
In Section
Seekers of Perl Wisdom