Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: cut vs split (suggestions)

by BrowserUk (Pope)
on Apr 17, 2005 at 04:52 UTC ( #448581=note: print w/replies, xml ) Need Help??


in reply to Re: cut vs split (suggestions)
in thread cut vs split (suggestions)

Once you read each line of output from cut via the piped open, you are still going to have to split it to an array in order to utilise the fields, so I think most if not all the performance advantage of using cut will be lost, though spitting 15 fields cut from 200 rather than all 200 may help.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco.
Rule 1 has a caveat! -- Who broke the cabal?

Replies are listed 'Best First'.
Re^3: cut vs split (suggestions)
by tlm (Prior) on Apr 17, 2005 at 05:13 UTC

    The internal pipe approach is about 1.5X faster than the pure Perl approach (though still a far cry from cut):

    % time perl -le 'open IN, q( cut -d, -f"1-15" numbers.csv| ); \ print join ",", ( chomp and @F = split /,/ ) while <IN>' > /dev/null 19.49s user 0.00s system 96% cpu 20.289 total

    Update: But keep in mind that the numbers above are for a relatively fast cut command. The improvement with sk's cut will be more modest; it'd be interesting to see the actual numbers.

    the lowliest monk

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://448581]
help
Chatterbox?
[tye]: We use auditd for security monitoring. So we can rely on auditing being enabled. I'm not sure who would want to not be able to audit. Maybe some VM inside another system with audit?
[SuicideJunkie]: spies would want a system to not be able to audit.
[erix]: spies should use a type-writer, no power needed, no auditable
[erix]: if all else fails, eat the paper

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2017-06-23 20:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (555 votes). Check out past polls.