diff options
author | schneems <richard.schneeman@gmail.com> | 2014-08-14 12:29:25 -0500 |
---|---|---|
committer | schneems <richard.schneeman@gmail.com> | 2014-08-14 12:46:06 -0500 |
commit | 4d47220d7c4d07d23e4a1f01bdd6d86fa76237ca (patch) | |
tree | 6483f759a2a46f3c2c773d19768a70f36e45d0f0 /ci/travis.rb | |
parent | 71e8f199d75fcad804c6a36e089b6b8fb4071192 (diff) | |
download | rails-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 'ci/travis.rb')
0 files changed, 0 insertions, 0 deletions