Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: split function

by aaron_baugher (Curate)
on Sep 10, 2012 at 21:56 UTC ( #992864=note: print w/replies, xml ) Need Help??

in reply to split function

One thing I've learned here at PerlMonks is that unpack can be very fast at this kind of thing:

abaugher@bannor> perl Rate regexit unpackit regexit 133333/s -- -43% unpackit 234432/s 76% -- abaugher@bannor> cat #!/usr/bin/env perl use Modern::Perl; use Benchmark qw(:all); my $p = 'HKTTLDSSRTTTTAABNNRFGHGHGYYH'; cmpthese( 1_000_000, { 'regexit' => \&regexit, 'unpackit' => \&unpackit, }); sub regexit { my @p = $p =~ /.{1,3}/g; } sub unpackit { my @p = unpack '(A3)*', $p; }

Aaron B.
Available for small or large Perl jobs; see my home node.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992864]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2017-02-21 20:15 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (318 votes). Check out past polls.