aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2016-02-18 07:50:53 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2016-02-18 07:50:53 -0800
commit13c4cc3b5aea02716b7459c0da641438077f5236 (patch)
tree1a1c9a957a5bf123160d8614c30e9df81773407a /.github
parentd81e6bbb3b566cf6b469a75ad2fc0d14f5b662be (diff)
downloadrails-13c4cc3b5aea02716b7459c0da641438077f5236.tar.gz
rails-13c4cc3b5aea02716b7459c0da641438077f5236.tar.bz2
rails-13c4cc3b5aea02716b7459c0da641438077f5236.zip
remove object `hash` cache
I don't think caching this method makes any difference on Ruby 2.0: ``` require 'benchmark/ips' class Foo alias :object_hash :hash attr_reader :hash def initialize @hash = object_hash end end class Bar end hash = {} foo = Foo.new bar = Bar.new Benchmark.ips do |x| x.report("foo") { hash[foo] } x.report("bar") { hash[bar] } x.report("foo.hash") { foo.hash } x.report("bar.hash") { bar.hash } end __END__ [aaron@TC ruby (trunk)]$ ruby test.rb Warming up -------------------------------------- foo 118.361k i/100ms bar 118.637k i/100ms Calculating ------------------------------------- foo 7.944M (± 3.1%) i/s - 39.769M bar 7.931M (± 3.4%) i/s - 39.625M [aaron@TC ruby (trunk)]$ ruby test.rb Warming up -------------------------------------- foo 122.180k i/100ms bar 120.492k i/100ms foo.hash 123.397k i/100ms bar.hash 119.312k i/100ms Calculating ------------------------------------- foo 8.002M (± 4.2%) i/s - 39.953M bar 8.037M (± 4.5%) i/s - 40.124M foo.hash 8.819M (± 3.9%) i/s - 44.053M bar.hash 7.856M (± 4.1%) i/s - 39.254M ```
Diffstat (limited to '.github')
0 files changed, 0 insertions, 0 deletions