Permalink
Browse files

Reduce String allocations when building Action View tags

This method is called against each tag option for each tag,
and creates an extra garbage String per each call
  • Loading branch information...
amatsuda committed Apr 26, 2018
1 parent ac93e7b commit 9276ea89d2b0be9fdd1ad6590857f8d45a38c267
Showing with 2 additions and 1 deletion.
  1. +2 −1 actionview/lib/action_view/helpers/tag_helper.rb
@@ -90,7 +90,8 @@ def tag_option(key, value, escape)
else
value = escape ? ERB::Util.unwrapped_html_escape(value) : value.to_s
end
%(#{key}="#{value.gsub('"'.freeze, '"'.freeze)}")
value.gsub!('"'.freeze, '"'.freeze)
%(#{key}="#{value}")
end
private

0 comments on commit 9276ea8

Please sign in to comment.