aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/cache_helper.rb
diff options
context:
space:
mode:
authorschneems <richard.schneeman@gmail.com>2014-08-14 12:29:25 -0500
committerschneems <richard.schneeman@gmail.com>2014-08-14 12:46:06 -0500
commit4d47220d7c4d07d23e4a1f01bdd6d86fa76237ca (patch)
tree6483f759a2a46f3c2c773d19768a70f36e45d0f0 /actionview/lib/action_view/helpers/cache_helper.rb
parent71e8f199d75fcad804c6a36e089b6b8fb4071192 (diff)
downloadrails-4d47220d7c4d07d23e4a1f01bdd6d86fa76237ca.tar.gz
rails-4d47220d7c4d07d23e4a1f01bdd6d86fa76237ca.tar.bz2
rails-4d47220d7c4d07d23e4a1f01bdd6d86fa76237ca.zip
Perf optimization for `url_for` called w/ Hash
Benchmarking the existing code: ```ruby { :only_path => options[:host].nil? }.merge!(options.symbolize_keys)) ``` Against optimized code, that does not require a new hash or a merge: ```ruby options = options.symbolize_keys options[:only_path] = options[:host].nil? unless options.key?(:only_path) options ``` We see a statistically significant performance gain: ![](https://www.dropbox.com/s/onocpc0zfw4kjxl/Screenshot%202014-08-14%2012.45.30.png?dl=1) Updated to not mutate incoming parameters
Diffstat (limited to 'actionview/lib/action_view/helpers/cache_helper.rb')
0 files changed, 0 insertions, 0 deletions