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

Version Path
brianmario-yajl-ruby-0.5.10 benchmark/http.rb
brianmario-yajl-ruby-0.5.11 benchmark/http.rb
brianmario-yajl-ruby-0.5.12 benchmark/http.rb
brianmario-yajl-ruby-0.5.2 benchmark/http.rb
brianmario-yajl-ruby-0.5.3 benchmark/http.rb
brianmario-yajl-ruby-0.5.4 benchmark/http.rb
brianmario-yajl-ruby-0.5.5 benchmark/http.rb
brianmario-yajl-ruby-0.5.6 benchmark/http.rb
brianmario-yajl-ruby-0.5.7 benchmark/http.rb
brianmario-yajl-ruby-0.5.8 benchmark/http.rb
brianmario-yajl-ruby-0.5.9 benchmark/http.rb
brianmario-yajl-ruby-0.6.0 benchmark/http.rb
brianmario-yajl-ruby-0.6.1 benchmark/http.rb
brianmario-yajl-ruby-0.6.3 benchmark/http.rb
jdg-yajl-ruby-0.5.12 benchmark/http.rb
oortle-yajl-ruby-0.5.8 benchmark/http.rb
yajl-ruby-0.6.3 benchmark/http.rb
yajl-ruby-0.6.2 benchmark/http.rb
yajl-ruby-0.6.0 benchmark/http.rb
yajl-ruby-0.6.1 benchmark/http.rb