Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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 chanting in the Monastery: (3)
As of 2016-02-09 08:50 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (309 votes), past polls