Skip to content

Instantly share code, notes, and snippets.

@havenwood

havenwood/irc.rb Secret

Created June 24, 2015 20:46
Show Gist options
  • Save havenwood/8f4e4ee03aa79549caf0 to your computer and use it in GitHub Desktop.
Save havenwood/8f4e4ee03aa79549caf0 to your computer and use it in GitHub Desktop.
{} vs Hash.new
>> Benchmark.ips do |ips|
| ips.report('literal') { {} }
| ips.report('longform') { Hash.new }
| end
Calculating -------------------------------------
literal 173.498k i/100ms
longform 98.332k i/100ms
-------------------------------------------------
literal 9.825M (± 6.7%) i/s - 48.926M
longform 1.815M (±32.7%) i/s - 7.768M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment