Skip to content

Instantly share code, notes, and snippets.

@dagolden
Created October 27, 2010 15:08
Show Gist options
  • Save dagolden/649209 to your computer and use it in GitHub Desktop.
Save dagolden/649209 to your computer and use it in GitHub Desktop.
benchmarking keys
# NOTE: %HASH and $HASH are package vars; %hash and $hash are lexical vars
Rate keys %$HASH keys %$hash keys hashref() keys %{$hash} keys %{ hashref() } keys %hash keys %HASH keys $hash keys $HASH
keys %$HASH 6335/s -- 0% -0% -0% -0% -42% -42% -42% -43%
keys %$hash 6335/s 0% -- -0% -0% -0% -42% -42% -42% -43%
keys hashref() 6364/s 0% 0% -- 0% 0% -42% -42% -42% -42%
keys %{$hash} 6364/s 0% 0% 0% -- 0% -42% -42% -42% -42%
keys %{ hashref() } 6364/s 0% 0% 0% 0% -- -42% -42% -42% -42%
keys %hash 10904/s 72% 72% 71% 71% 71% -- 0% -1% -1%
keys %HASH 10904/s 72% 72% 71% 71% 71% 0% -- -1% -1%
keys $hash 11008/s 74% 74% 73% 73% 73% 1% 1% -- -0%
keys $HASH 11060/s 75% 75% 74% 74% 74% 1% 1% 0% --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment