Permalink
Browse files

Move two hotspots to use Hash[] rather than Hash#dup

  • Loading branch information...
tenderlove committed Oct 15, 2012
1 parent 046ab84 commit 02174a3efc6fa8f2e5e6f114e4cf0d8a06305b6a
Showing with 5 additions and 3 deletions.
  1. +5 −3 activerecord/lib/active_record/relation.rb
@@ -91,8 +91,10 @@ def new(*args, &block)
end end
def initialize_copy(other) def initialize_copy(other)
@values = @values.dup # This method is a hot spot, so for now, use Hash[] to dup the hash.
@values[:bind] = @values[:bind].dup if @values[:bind] # https://bugs.ruby-lang.org/issues/7166
@values = Hash[@values]
@values[:bind] = @values[:bind].dup if @values.key? :bind
reset reset
end end
@@ -540,7 +542,7 @@ def blank?
end end
def values def values
@values.dup Hash[@values]
end end
def inspect def inspect

0 comments on commit 02174a3

Please sign in to comment.