From f2a906337355e3ddd5f42182711075e9404f7096 Mon Sep 17 00:00:00 2001 From: Eugene Kenny Date: Mon, 23 Apr 2018 22:00:40 +0100 Subject: Save a hash allocation in MySQL statement pool There's no need to wrap the statement in a hash with a single key. --- .../active_record/connection_adapters/mysql/database_statements.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'activerecord/lib/active_record/connection_adapters/mysql') diff --git a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb index 458c9bfd70..4106ce01be 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb @@ -71,10 +71,7 @@ module ActiveRecord log(sql, name, binds, type_casted_binds) do if cache_stmt - cache = @statements[sql] ||= { - stmt: @connection.prepare(sql) - } - stmt = cache[:stmt] + stmt = @statements[sql] ||= @connection.prepare(sql) else stmt = @connection.prepare(sql) end -- cgit v1.2.3