Sha256: 544fd3aa6a3b6f2449cc5fdfc359ee5c2940fc7490b4e2d42a3a05fdaec50a90

Contents?: true

Size: 811 Bytes

Versions: 4

Compression:

Stored size: 811 Bytes

Contents

#!/usr/bin/env ruby -wW1

$: << '.'
$: << '../lib'
$: << '../ext'

if __FILE__ == $0
  if (i = ARGV.index('-I'))
    x,path = ARGV.slice!(i, 2)
    $: << path
  end
end

require 'optparse'
require 'ox'
require 'oj'
require 'perf'

$indent = 0
$iter = 1000

opts = OptionParser.new

opts.on("-i", "--iterations [Int]", Integer, "iterations")  { |i| $iter = i }
opts.on("-h", "--help", "Show this display")                { puts opts; Process.exit!(0) }
files = opts.parse(ARGV)

$obj = "x" * 50_000

Oj.default_options = { :mode => :strict, :indent => $indent }

puts '-' * 80
puts "Dump Performance"
perf = Perf.new()
perf.add('Oj', 'dump') { Oj.dump($obj) }
perf.add('Ox', 'dump') { Ox.dump($obj, :indent => $indent, :circular => $circular) }
perf.add('Marshal', 'dump') { Marshal.dump($obj) }
perf.run($iter)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
oj-2.9.4 test/perf_str.rb
oj-2.9.3 test/perf_str.rb
oj-2.9.2 test/perf_str.rb
oj-2.9.1 test/perf_str.rb