benchmark/javascript_escape.rb in escape_utils-1.2.2 vs benchmark/javascript_escape.rb in escape_utils-1.3.0
- old
+ new
@@ -11,10 +11,10 @@
extend ActionView::Helpers::JavaScriptHelper
end
url = "http://ajax.googleapis.com/ajax/libs/dojo/1.4.3/dojo/dojo.xd.js.uncompressed.js"
javascript = `curl -s #{url}`
-javascript = javascript.force_encoding('utf-8') if javascript.respond_to?(:force_encoding)
+javascript = javascript.force_encoding('utf-8')
puts "Escaping #{javascript.bytesize} bytes of javascript, from #{url}"
Benchmark.ips do |x|
x.report "ActionView::Helpers::JavaScriptHelper#escape_javascript" do |times|
times.times do