aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/examples/performance.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/examples/performance.rb')
-rw-r--r--activerecord/examples/performance.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/examples/performance.rb b/activerecord/examples/performance.rb
index 63822731d5..22f867d783 100644
--- a/activerecord/examples/performance.rb
+++ b/activerecord/examples/performance.rb
@@ -73,9 +73,16 @@ puts 'Inserting 10,000 users and exhibits...'
)
end
+ActiveRecord::IdentityMap.enabled = true unless ENV['IM'] == "disabled"
+
+def clear_identity_map!
+ ActiveRecord::IdentityMap.clear
+end
+
require 'benchmark'
Benchmark.bm(46) do |x|
+ clear_identity_map!
ar_obj = Exhibit.find(1)
attrs = { :name => 'sam' }
attrs_first = { :name => 'sam' }