in reply to Re:x2 Counting keys with defined or undefined elements in a hash
in thread Counting keys with defined or undefined elements in a hash

Still, iterating over a 10_000_000 element list more than 160 thousand times a second isn't too shabby a performance...

In fact, it's not shabby enough. That sort of speed should have made you take another look at your benchmark.

Try changing your cmpthese() call to

cmpthese( -5, { for => sub { by_for(\%h) }, grep => sub { by_grep(\%h) }, } );

-sauoq
"My two cents aren't worth a dime.";
  • Comment on Re: Re:x2 Counting keys with defined or undefined elements in a hash
  • Download Code