aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-03-01 16:05:50 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2015-03-01 16:05:58 -0800
commit402331ed2dedd2c2328a6b353341bd9eca7b6aa6 (patch)
treeea518bf0050eed4120f1e05067683cb91f75c18c /actionpack/lib/action_dispatch
parente1e2b54e853a9b405f10bab110c28064164a7469 (diff)
downloadrails-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.rb2
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]