From 2a4620e8dde15cef549867d5ea665eed424ebb64 Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Mon, 21 Feb 2011 12:47:37 -0800 Subject: [PATCH] update usage of Benchmark#report --- benchmark/html_escape.rb | 18 ++++++------------ benchmark/html_unescape.rb | 6 ++---- benchmark/javascript_escape.rb | 6 ++---- benchmark/javascript_unescape.rb | 3 +-- benchmark/url_escape.rb | 18 ++++++------------ benchmark/url_unescape.rb | 15 +++++---------- 6 files changed, 22 insertions(+), 44 deletions(-) diff --git a/benchmark/html_escape.rb b/benchmark/html_escape.rb index 9265e0e..e569bad 100644 --- a/benchmark/html_escape.rb +++ b/benchmark/html_escape.rb @@ -22,43 +22,37 @@ module HamlBench puts "Escaping #{html.bytesize} bytes of html #{times} times, from #{url}" Benchmark.bmbm do |x| - x.report do - puts "Rack::Utils.escape_html" + x.report "Rack::Utils.escape_html" do times.times do Rack::Utils.escape_html(html) end end - x.report do - puts "Haml::Helpers.html_escape" + x.report "Haml::Helpers.html_escape" do times.times do HamlBench.html_escape(html) end end - x.report do - puts "ERB::Util.html_escape" + x.report "ERB::Util.html_escape" do times.times do ERB::Util.html_escape(html) end end - x.report do - puts "CGI.escapeHTML" + x.report "CGI.escapeHTML" do times.times do CGI.escapeHTML(html) end end - x.report do - puts "fast_xs_extra#fast_xs_html" + x.report "fast_xs_extra#fast_xs_html" do times.times do html.fast_xs_html end end - x.report do - puts "EscapeUtils.escape_html" + x.report "EscapeUtils.escape_html" do times.times do EscapeUtils.escape_html(html) end diff --git a/benchmark/html_unescape.rb b/benchmark/html_unescape.rb index f2cf75a..3dce396 100644 --- a/benchmark/html_unescape.rb +++ b/benchmark/html_unescape.rb @@ -20,15 +20,13 @@ module HamlBench puts "Unescaping #{escaped_html.bytesize} bytes of escaped html #{times} times, from #{url}" Benchmark.bmbm do |x| - x.report do - puts "CGI.unescapeHTML" + x.report "CGI.unescapeHTML" do times.times do CGI.unescapeHTML(escaped_html) end end - x.report do - puts "EscapeUtils.unescape_html" + x.report "EscapeUtils.unescape_html" do times.times do EscapeUtils.unescape_html(escaped_html) end diff --git a/benchmark/javascript_escape.rb b/benchmark/javascript_escape.rb index 443f214..c7b4377 100644 --- a/benchmark/javascript_escape.rb +++ b/benchmark/javascript_escape.rb @@ -18,15 +18,13 @@ class ActionPackBench puts "Escaping #{javascript.bytesize} bytes of javascript #{times} times, from #{url}" Benchmark.bmbm do |x| - x.report do - puts "ActionView::Helpers::JavaScriptHelper#escape_javascript" + x.report "ActionView::Helpers::JavaScriptHelper#escape_javascript" do times.times do ActionPackBench.escape_javascript(javascript) end end - x.report do - puts "EscapeUtils.escape_javascript" + x.report "EscapeUtils.escape_javascript" do times.times do EscapeUtils.escape_javascript(javascript) end diff --git a/benchmark/javascript_unescape.rb b/benchmark/javascript_unescape.rb index 2024fd8..7124350 100644 --- a/benchmark/javascript_unescape.rb +++ b/benchmark/javascript_unescape.rb @@ -14,8 +14,7 @@ puts "Escaping #{escaped_javascript.bytesize} bytes of javascript #{times} times, from #{url}" Benchmark.bmbm do |x| - x.report do - puts "EscapeUtils.escape_javascript" + x.report "EscapeUtils.escape_javascript" do times.times do EscapeUtils.unescape_javascript(escaped_javascript) end diff --git a/benchmark/url_escape.rb b/benchmark/url_escape.rb index b942129..7ec8358 100644 --- a/benchmark/url_escape.rb +++ b/benchmark/url_escape.rb @@ -17,43 +17,37 @@ puts "Escaping a #{url.bytesize} byte URL #{times} times" Benchmark.bmbm do |x| - x.report do - puts "ERB::Util.url_encode" + x.report "ERB::Util.url_encode" do times.times do ERB::Util.url_encode(url) end end - x.report do - puts "Rack::Utils.escape" + x.report "Rack::Utils.escape" do times.times do Rack::Utils.escape(url) end end - x.report do - puts "CGI.escape" + x.report "CGI.escape" do times.times do CGI.escape(url) end end - x.report do - puts "URLEscape#escape" + x.report "URLEscape#escape" do times.times do URLEscape.escape(url) end end - x.report do - puts "fast_xs_extra#fast_xs_url" + x.report "fast_xs_extra#fast_xs_url" do times.times do url.fast_xs_url end end - x.report do - puts "EscapeUtils.escape_url" + x.report "EscapeUtils.escape_url" do times.times do EscapeUtils.escape_url(url) end diff --git a/benchmark/url_unescape.rb b/benchmark/url_unescape.rb index 023ce0b..e6d288c 100644 --- a/benchmark/url_unescape.rb +++ b/benchmark/url_unescape.rb @@ -17,36 +17,31 @@ puts "Escaping a #{url.bytesize} byte URL #{times} times" Benchmark.bmbm do |x| - x.report do - puts "Rack::Utils.unescape" + x.report "Rack::Utils.unescape" do times.times do Rack::Utils.unescape(escaped_url) end end - x.report do - puts "CGI.unescape" + x.report "CGI.unescape" do times.times do CGI.unescape(escaped_url) end end - x.report do - puts "URLEscape#unescape" + x.report "URLEscape#unescape" do times.times do URLEscape.unescape(escaped_url) end end - x.report do - puts "fast_xs_extra#fast_uxs_cgi" + x.report "fast_xs_extra#fast_uxs_cgi" do times.times do url.fast_uxs_cgi end end - x.report do - puts "EscapeUtils.unescape_url" + x.report "EscapeUtils.unescape_url" do times.times do EscapeUtils.unescape_url(escaped_url) end