in reply to Re^2: Faster Hash Slices
in thread Faster Hash Slices
Seems to be the case that named hash lookups are (marginally, but consistently) quicker:
{ my $ref = { 1 .. 1e6 }; my %h = 1 .. 1e6; cmpthese -5,{ a => sub{ exists $ref->{$_} and 1 for 1 .. 1e6; }, b => sub{ exists $h{$_} and 1 for 1 .. 1e6; } } };; Rate a b a 1.24/s -- -3% b 1.28/s 3% -- Rate a b a 1.36/s -- -5% b 1.43/s 5% -- Rate a b a 1.24/s -- -3% b 1.28/s 3% -- Rate a b a 1.23/s -- -5% b 1.29/s 5% -- Rate a b a 1.27/s -- -3% b 1.30/s 3% --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Faster Hash Slices
by shmem (Chancellor) on Nov 28, 2013 at 15:39 UTC | |
|
Re^4: Faster Hash Slices
by choroba (Cardinal) on Nov 28, 2013 at 14:18 UTC | |
by BrowserUk (Patriarch) on Nov 28, 2013 at 14:35 UTC | |
by BrowserUk (Patriarch) on Nov 28, 2013 at 15:24 UTC |