Sha256: 01f58cc2fc83ac2564f023d2fa6edbb3ee8db36d3a178f45cd80b29294580c07
Contents?: true
Size: 738 Bytes
Versions: 7
Compression:
Stored size: 738 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 'activesupport' 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
7 entries across 7 versions & 1 rubygems