提交 402331ed 编写于 作者: A Aaron Patterson

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
```
上级 e1e2b54e
......@@ -67,7 +67,7 @@ def full_url_for(options)
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]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册