From 9276ea89d2b0be9fdd1ad6590857f8d45a38c267 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 27 Apr 2018 02:54:53 +0900 Subject: 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 --- actionview/lib/action_view/helpers/tag_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb index b73c4be1ee..42a9277564 100644 --- a/actionview/lib/action_view/helpers/tag_helper.rb +++ b/actionview/lib/action_view/helpers/tag_helper.rb @@ -90,7 +90,8 @@ module ActionView 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 -- cgit v1.2.3