in reply to Re^2: cut vs split (suggestions)
in thread cut vs split (suggestions)
Faster than mine also:
[ 4:40:33.95] P:\test>cut -d, -f 1-15 data\25x500000.csv >nul [ 4:41:13.59] P:\test> [ 4:42:48.34] P:\test>perl -lanF, -e "BEGIN{ $,=','} print @F[0..14];" + data\25x500000.csv >nul [ 4:43:25.60] P:\test>
40 seconds for cut versus 37 for Perl.
That said, that time for your cut seems almost to good to be true. You are sure that cut can't somehow detect that it is writing to the null device and simply skip it--like perl sort detects a null context and skips?
It's probably just a very well optimised, time-honed Unix utility versus a bad Win32 emulation, but 0.80s for 500,000 records is remarkable enough to make me check.
I just remembered something I discovered a long time ago. The Win32 nul device is slower than writing to a file!?
[ 4:53:24.51] P:\test>cut -d, -f 1-15 data\25x500000.csv >junk [ 4:53:38.01] P:\test>
Actually writing the file cuts the 40 seconds to 14. Go figure.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: cut vs split (suggestions)
by tlm (Prior) on Apr 17, 2005 at 04:30 UTC | |
by BrowserUk (Patriarch) on Apr 17, 2005 at 04:47 UTC | |
|
Re^4: cut vs split (suggestions)
by sk (Curate) on Apr 17, 2005 at 04:54 UTC | |
by tlm (Prior) on Apr 17, 2005 at 05:22 UTC | |
by sk (Curate) on Apr 17, 2005 at 05:42 UTC |