Sha256: f01800018c7dba8f47be7c6bce1c24c23f7e8e1d9831b8a0a055592145e83f8f
Contents?: true
Size: 712 Bytes
Versions: 28
Compression:
Stored size: 712 Bytes
Contents
# encoding: UTF-8 require 'rubygems' require 'benchmark' require 'yajl/http_stream' require 'yajl/gzip' require 'yajl/deflate' require 'yajl/bzip2' require 'json' require 'uri' require 'net/http' uri = URI.parse('http://search.twitter.com/search.json?q=github') # uri = URI.parse('http://localhost/yajl-ruby.git/benchmark/subjects/contacts.json') times = ARGV[0] ? ARGV[0].to_i : 1 puts "Starting benchmark parsing #{uri.to_s} #{times} times\n\n" Benchmark.bm { |x| x.report { puts "Yajl::HttpStream.get" times.times { Yajl::HttpStream.get(uri) } } x.report { puts "JSON.parser" times.times { JSON.parse(Net::HTTP.get_response(uri).body, :max_nesting => false) } } }
Version data entries
28 entries across 28 versions & 4 rubygems