aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-25 11:11:51 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-25 11:11:51 -0700
commitfc088d4e8fdc7fcc710df094ce4ae6faa27d8c8d (patch)
tree42cef74297825e767dd7e836b467f0787712ada6 /activerecord
parentb7e0408ca922cf51228818edbfdcd5c63e3cb84e (diff)
downloadrails-fc088d4e8fdc7fcc710df094ce4ae6faa27d8c8d.tar.gz
rails-fc088d4e8fdc7fcc710df094ce4ae6faa27d8c8d.tar.bz2
rails-fc088d4e8fdc7fcc710df094ce4ae6faa27d8c8d.zip
cache the instrumentor for a speed gain
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_adapter.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index 4799b693c5..618560087e 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -44,6 +44,7 @@ module ActiveRecord
@runtime = 0
@query_cache_enabled = false
@query_cache = {}
+ @instrumenter = ActiveSupport::Notifications.instrumenter
end
# Returns the human-readable name of the adapter. Use mixed case - one
@@ -199,10 +200,9 @@ module ActiveRecord
def log(sql, name)
name ||= "SQL"
- instrumenter = ActiveSupport::Notifications.instrumenter
info = {}
- result = instrumenter.instrument("sql.active_record",
+ result = @instrumenter.instrument("sql.active_record",
{:sql => sql, :name => name, :connection_id => object_id}, info) do
yield
end