Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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.

Comment on Re: split function
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992864]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2015-11-28 03:47 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (737 votes), past polls