aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-06-02 16:12:18 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-06-02 16:12:18 -0700
commit8899503f62a556a918c45b3e7b5c2effaaa943f4 (patch)
tree59490b9ee47eb3b56a9701242254458bcbc33d16 /actionview/lib
parent29a1b77c6b20984c620230afb7590fbfaf4823dd (diff)
downloadrails-8899503f62a556a918c45b3e7b5c2effaaa943f4.tar.gz
rails-8899503f62a556a918c45b3e7b5c2effaaa943f4.tar.bz2
rails-8899503f62a556a918c45b3e7b5c2effaaa943f4.zip
drastically reduce object allocations
before this change, we were allocating AS::SafeBuffer objects that were being interpolated in to a string, so the safe buffer object was being thrown away. This change only allocates a string (vs a string *and* a safebuffer) and interpolates the string. On my test application, this reduced the AS::SafeBuffer objects from 1527k per request to about 500 per request.
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/helpers/tag_helper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb
index a9f3b0ffbc..9b9ca7d60d 100644
--- a/actionview/lib/action_view/helpers/tag_helper.rb
+++ b/actionview/lib/action_view/helpers/tag_helper.rb
@@ -139,7 +139,7 @@ module ActionView
def content_tag_string(name, content, options, escape = true)
tag_options = tag_options(options, escape) if options
- content = ERB::Util.h(content) if escape
+ content = ERB::Util.unwrapped_html_escape(content) if escape
"<#{name}#{tag_options}>#{PRE_CONTENT_STRINGS[name.to_sym]}#{content}</#{name}>".html_safe
end
@@ -174,7 +174,7 @@ module ActionView
def tag_option(key, value, escape)
value = value.join(" ") if value.is_a?(Array)
- value = ERB::Util.h(value) if escape
+ value = ERB::Util.unwrapped_html_escape(value) if escape
%(#{key}="#{value}")
end
end