Sha256: b090c5f36de63436f08daacdbfce34000a5a27818f33ff7a4ecadd13c9fd795c
Contents?: true
Size: 860 Bytes
Versions: 76
Compression:
Stored size: 860 Bytes
Contents
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..') $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') require 'rubygems' require 'benchmark' require 'yajl/http_stream' require 'yajl/gzip' require 'yajl/deflate' require 'yajl/bzip2' unless defined?(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.bmbm { |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
76 entries across 76 versions & 10 rubygems