diff options
Diffstat (limited to 'lib/ffi_yajl/benchmark/http.rb')
-rw-r--r-- | lib/ffi_yajl/benchmark/http.rb | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/ffi_yajl/benchmark/http.rb b/lib/ffi_yajl/benchmark/http.rb index 771e452..b94a46c 100644 --- a/lib/ffi_yajl/benchmark/http.rb +++ b/lib/ffi_yajl/benchmark/http.rb @@ -16,17 +16,13 @@ uri = URI.parse('http://search.twitter.com/search.json?q=github') times = ARGV[0] ? ARGV[0].to_i : 1 puts "Starting benchmark parsing #{uri} #{times} times\n\n" -Benchmark.bmbm { |x| - x.report { +Benchmark.bmbm do |x| + x.report do puts "Yajl::HttpStream.get" - times.times { - Yajl::HttpStream.get(uri) - } - } - x.report { + times.times { Yajl::HttpStream.get(uri) } + end + x.report do puts "JSON.parser" - times.times { - JSON.parse(Net::HTTP.get_response(uri).body, max_nesting: false) - } - } -} + times.times { JSON.parse(Net::HTTP.get_response(uri).body, max_nesting: false) } + end +end |