diff options
author | Akira Matsuda <ronnie@dio.jp> | 2018-04-27 02:54:53 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2018-04-27 02:54:53 +0900 |
commit | 9276ea89d2b0be9fdd1ad6590857f8d45a38c267 (patch) | |
tree | 25d4cf2fae0fecc6ab38a2858b56c6cd04a3e772 | |
parent | ac93e7b5c192c39cfc224a1259a68c3b1e7bf0aa (diff) | |
download | rails-9276ea89d2b0be9fdd1ad6590857f8d45a38c267.tar.gz rails-9276ea89d2b0be9fdd1ad6590857f8d45a38c267.tar.bz2 rails-9276ea89d2b0be9fdd1ad6590857f8d45a38c267.zip |
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
-rw-r--r-- | actionview/lib/action_view/helpers/tag_helper.rb | 3 |
1 files changed, 2 insertions, 1 deletions
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 |