aboutsummaryrefslogtreecommitdiffstats
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
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 ```
-rw-r--r--actionview/lib/action_view/lookup_context.rb6
1 files changed, 0 insertions, 6 deletions
diff --git a/actionview/lib/action_view/lookup_context.rb b/actionview/lib/action_view/lookup_context.rb
index 126f289f55..2a1f4378f5 100644
--- a/actionview/lib/action_view/lookup_context.rb
+++ b/actionview/lib/action_view/lookup_context.rb
@@ -55,9 +55,7 @@ module ActionView
class DetailsKey #:nodoc:
alias :eql? :equal?
- alias :object_hash :hash
- attr_reader :hash
@details_keys = Concurrent::Map.new
def self.get(details)
@@ -71,10 +69,6 @@ module ActionView
def self.clear
@details_keys.clear
end
-
- def initialize
- @hash = object_hash
- end
end
# Add caching behavior on top of Details.