in reply to Re^6: Out of Memory
in thread Out of Memory
how does ... differ in execution from ...
Hm. "in execution"?
$s = 'ab'x 10e6;; cmpthese -1, { a => q[ my $n = 0; while( $s =~ m[ab]g ){ $n++ }; ], b=>q[ my $n = 0; ++$n while $s =~ m[ab]g; ], };; s/iter a b a 2.31 -- -37% b 1.45 59% --
Don't use post increment if you aren't using the pre-increment value. Don't create scopes you don't need.
Or, get into the habit of not doing anything you don't need to.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Out of Memory
by Michael Kittrell (Novice) on Mar 28, 2013 at 22:33 UTC |