diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-03-01 16:05:50 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-03-01 16:05:58 -0800 |
commit | 402331ed2dedd2c2328a6b353341bd9eca7b6aa6 (patch) | |
tree | ea518bf0050eed4120f1e05067683cb91f75c18c /actionpack/lib/action_dispatch | |
parent | e1e2b54e853a9b405f10bab110c28064164a7469 (diff) | |
download | rails-402331ed2dedd2c2328a6b353341bd9eca7b6aa6.tar.gz rails-402331ed2dedd2c2328a6b353341bd9eca7b6aa6.tar.bz2 rails-402331ed2dedd2c2328a6b353341bd9eca7b6aa6.zip |
drop string allocations per model url_for call in views
```ruby
article = Article.new.tap(&:save!)
view.url_for article
result = ObjectSpace::AllocationTracer.trace do
3000.times { view.url_for article }
end
p ObjectSpace::AllocationTracer.allocated_count_table[:T_STRING] / 3000
```
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/http/url.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index 001b14ec97..7da6301ac4 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -67,7 +67,7 @@ module ActionDispatch end def path_for(options) - path = options[:script_name].to_s.chomp("/") + path = options[:script_name].to_s.chomp("/".freeze) path << options[:path] if options.key?(:path) add_trailing_slash(path) if options[:trailing_slash] |