diff options
author | schneems <richard.schneeman@gmail.com> | 2015-07-25 16:58:22 -0500 |
---|---|---|
committer | schneems <richard.schneeman@gmail.com> | 2015-07-30 12:31:04 -0500 |
commit | 1993e2ccbd7c5651278ea30bdc9d8034f5197945 (patch) | |
tree | ff127650c2bba2b88c8601b832bb50fd7ac3d55e /actionpack | |
parent | 3fb9e802436a5e3b5733ea9d5cb3964a32a3d8f9 (diff) | |
download | rails-1993e2ccbd7c5651278ea30bdc9d8034f5197945.tar.gz rails-1993e2ccbd7c5651278ea30bdc9d8034f5197945.tar.bz2 rails-1993e2ccbd7c5651278ea30bdc9d8034f5197945.zip |
Avoid hash duplication by skipping mutation
If we don't mutate the `recall` hash, then there's no reason to duplicate it. While this change doesn't get rid of that many objects, each hash object it gets rid of was massive.
Saves 888 string objects per request, 206,013 bytes (thats 0.2 mb which is kinda a lot).
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 848b20b054..a006a146ed 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -599,7 +599,7 @@ module ActionDispatch def initialize(named_route, options, recall, set) @named_route = named_route @options = options - @recall = recall.dup + @recall = recall @set = set normalize_recall! @@ -621,7 +621,7 @@ module ActionDispatch def use_recall_for(key) if @recall[key] && (!@options.key?(key) || @options[key] == @recall[key]) if !named_route_exists? || segment_keys.include?(key) - @options[key] = @recall.delete(key) + @options[key] = @recall[key] end end end |