Sha256: 3cd1f51384707c8efc4bd5bbe966c228df4fcf6614df48dfb110ad24257357a6

Contents?: true

Size: 1.04 KB

Versions: 102

Compression:

Stored size: 1.04 KB

Contents

# coding: utf-8
require 'benchmark/ips'
require 'json'
require File.expand_path('lib/jrjackson')

obj = {
  :name => "Fredrick Smith",
  :quantity => 1_000_000,
  :addresses => {
    :address1 => "12 Heather Street, Parnell, Auckland, New Zealand",
    :address2 => "1 Queen Street, CBD, Auckland, New Zealand"
  }
}

json = JSON.dump(obj)

puts "Decode ====================="

puts 'Sleeping'
sleep 45
puts 'Working'

# -JXrunhprof:cpu=samples,depth=30,file=jrjackson.hprof

Benchmark.ips do |x|
  x.config(time: 20, warmup: 20)

  x.report("JrJackson new Ruby") { JrJackson::Ruby.parse(json, nil) }
  # x.report("JrJackson Raw") { JrJackson::Java.parse(json, nil) }
  # x.report("JSON") { JSON.load(json) }

  # x.report("JrJackson") { JrJackson::Raw.parse_sym(json) }

  # x.compare!
end

# puts "Encode ====================="
# Benchmark.ips do |x|
#   x.config(time: 5, warmup: 10)

#   x.report("JrJackson Raw") { JrJackson::Base.generate(obj) }
#   x.report("JrJackson") { JrJackson::Json.dump(obj) }
#   x.report("JSON") { JSON.dump(obj) }

#   x.compare!
# end

Version data entries

102 entries across 90 versions & 17 rubygems

Version Path
jrjackson-0.4.18-java alt_bench.rb
jrjackson-0.4.17-java alt_bench.rb
jrjackson-0.4.16-java alt_bench.rb
jrjackson-0.4.15-java alt_bench.rb
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.14-java/alt_bench.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.14-java/alt_bench.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.14-java/alt_bench.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.14-java/alt_bench.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb