rails/rails — pull request #16504 by schneems (2014-08-14 17:30:46+00:00)
Title: 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.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/0jtfclvdhc1qecn/Screenshot%202014-08-14%2012.29.59.png?dl=1)