Last active
August 29, 2015 14:01
-
-
Save kke/4e2220c653555318960d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Benchmark.bm do |x| | |
| hash = {:foo => "foo"} | |
| class Item | |
| def initialize | |
| @foo = "foo" | |
| end | |
| def foo | |
| @foo | |
| end | |
| end | |
| item = Item.new | |
| x.report("hash") { 1_000_000.times { hash[:foo] } } | |
| x.report("item") { 1_000_000.times { item.foo } } | |
| end | |
| user system total real | |
| hash 0.200000 0.000000 0.200000 ( 0.200694) | |
| item 0.230000 0.000000 0.230000 ( 0.225771) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment