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

Re: Premature and micro optimization...

by lidden (Curate)
on Jun 11, 2007 at 07:53 UTC ( [id://620433] : note . print w/replies, xml ) Need Help??


in reply to Premature and micro optimization...

Adding the match_and_tr sub missing from your code:
sub match_and_tr { my $string = shift; my( $id, $session ) = split( /\./, $string, 2 ); $id =~ /[a-z]/ and $id =~ tr/a-z/A-Z/; return( $id, $session ); }
I got :
Rate Old way Only TR LC Old way 193050/s -- -8% Only TR LC 209205/s 8% -- Rate Only TR UC Old way U Only TR UC 210084/s -- -2% Old way U 213675/s 2% --

Which is as expected. The sub that don't do any tring is of course faster.