mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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 ```
This commit is contained in:
parent
e1e2b54e85
commit
402331ed2d
1 changed files with 1 additions and 1 deletions
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue