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

Version Path
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/benchmark/http.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/benchmark/http.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/benchmark/http.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/yajl-ruby-1.4.3/benchmark/http.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/yajl-ruby-1.4.3/benchmark/http.rb
yajl-ruby-1.4.3 benchmark/http.rb
yajl-ruby-1.4.2 benchmark/http.rb
yajl-ruby-1.4.1 benchmark/http.rb
yajl-ruby-1.4.0 benchmark/http.rb
yajl-ruby-1.2.3 benchmark/http.rb
yajl-ruby-1.3.1 benchmark/http.rb
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/yajl-ruby-1.3.0/benchmark/http.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/yajl-ruby-1.3.0/benchmark/http.rb
yajl-ruby-1.2.2 benchmark/http.rb
yajl-ruby-1.3.0 benchmark/http.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/yajl-ruby-1.2.1/benchmark/http.rb
ffi-yajl-2.2.0 lib/ffi_yajl/benchmark/http.rb
ffi-yajl-2.2.0-universal-java lib/ffi_yajl/benchmark/http.rb
ffi-yajl-2.1.0-universal-java lib/ffi_yajl/benchmark/http.rb
ffi-yajl-2.1.0 lib/ffi_yajl/benchmark/http.rb