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
logstash-output-scalyr-0.1.3 vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.2 vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.8-java/alt_bench.rb
logstash-output-scalyr-0.1.2 vendor/bundle/jruby/2.5.0/gems/jrjackson-0.4.12-java/alt_bench.rb
jrjackson-0.4.12-java alt_bench.rb
jrjackson-0.4.11-java alt_bench.rb
jrjackson-0.4.10-java alt_bench.rb
jrjackson-0.4.9-java alt_bench.rb
jrjackson-0.4.8-java alt_bench.rb
jrjackson-0.4.7-java alt_bench.rb
logstash-filter-device_detection-1.0.7-java vendor/bundle/jruby/1.9/gems/jrjackson-0.4.6-java/alt_bench.rb
mrcooper-logstash-output-azuresearch-0.2.2 vendor/jruby/2.5.0/gems/jrjackson-0.4.6-java/alt_bench.rb
jrjackson-0.4.6-java alt_bench.rb
jrjackson-0.4.5-java alt_bench.rb
jrjackson-0.4.4-java alt_bench.rb
logstash-output-icinga-1.1.0 vendor/jruby/1.9/gems/jrjackson-0.4.2-java/alt_bench.rb
logstash-output-icinga-1.1.0 vendor/jruby/2.3.0/gems/jrjackson-0.4.2-java/alt_bench.rb
jrjackson-0.4.3-java alt_bench.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/jrjackson-0.4.2-java/alt_bench.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/jrjackson-0.4.2-java/alt_bench.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/jrjackson-0.4.2-java/alt_bench.rb