in reply to Re^3: Performance problems on splitting long strings
in thread Performance problems on splitting long strings

The $string variable contains '30'. I think you meant

my $string = join '',map { ('a'..'z')[rand 26] }1..30;

With this correction, unpack is faster. :-)

Rate regex1 regex2 substr unpack regex1 225055/s -- -1% -4% -53% regex2 228189/s 1% -- -3% -53% substr 235177/s 4% 3% -- -51% unpack 481548/s 114% 111% 105% --

Replies are listed 'Best First'.
Re^5: Performance problems on splitting long strings
by hdb (Monsignor) on Jan 30, 2014 at 20:53 UTC

    Thanks a lot! Teaches me a well-deserved lesson...