From d108288c2f684233298f97f18ac00de0b016deaa Mon Sep 17 00:00:00 2001 From: Dillon Welch Date: Thu, 29 Mar 2018 19:29:55 -0700 Subject: Turn on performance based cops Use attr_reader/attr_writer instead of methods method is 12% slower Use flat_map over map.flatten(1) flatten is 66% slower Use hash[]= instead of hash.merge! with single arguments merge! is 166% slower See https://github.com/rails/rails/pull/32337 for more conversation --- activesupport/lib/active_support/callbacks.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'activesupport/lib/active_support/callbacks.rb') diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index a1b841ec3d..c266b432c0 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -497,9 +497,7 @@ module ActiveSupport arg.halted || !@user_conditions.all? { |c| c.call(arg.target, arg.value) } end - def nested - @nested - end + attr_reader :nested def final? !@call_template @@ -578,7 +576,7 @@ module ActiveSupport end protected - def chain; @chain; end + attr_reader :chain private -- cgit v1.2.3