Sha256: 6bf2e687254f4c69e70fb2421c08e81990829d5d8267edc022216eb6e1e853bf

Contents?: true

Size: 626 Bytes

Versions: 24

Compression:

Stored size: 626 Bytes

Contents

#!/usr/bin/env ruby -wW1
# encoding: UTF-8

$: << File.join(File.dirname(__FILE__), "../lib")
$: << File.join(File.dirname(__FILE__), "../ext")

require 'yajl'
require 'oj'

iter = 100
s = File.read("boo.json")
start = Time.now
iter.times do
  Oj.load(s)
end
oj_dt = Time.now - start
puts "%d Oj.load()s in %0.3f seconds or %0.1f loads/second" % [iter, oj_dt, iter/oj_dt]

start = Time.now
iter.times do
  Yajl::Parser.parse(s)
end
yajl_dt = Time.now - start
puts "%d Yajl::Parser.parse()s in %0.3f seconds or %0.1f parsed/second" % [iter, yajl_dt, iter/yajl_dt]

puts "Oj is %0.1f times faster than YAJL" % [yajl_dt / oj_dt]

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
oj-1.3.4 test/boo.rb
oj-1.3.0 test/boo.rb
oj-1.2.13 test/boo.rb
oj-1.2.12 test/boo.rb
oj-1.2.10 test/boo.rb
oj-1.2.8 test/boo.rb
oj-1.2.7 test/boo.rb
oj-1.2.6 test/boo.rb
oj-1.2.3 test/boo.rb
oj-1.2.1 test/boo.rb
oj-1.2.0 test/boo.rb
oj-1.1.0 test/boo.rb
oj-1.0.6 test/boo.rb
oj-1.0.5 test/boo.rb
oj-1.0.4 test/boo.rb
oj-1.0.3 test/boo.rb
oj-1.0.2 test/boo.rb
oj-1.0.1 test/boo.rb
oj-1.0.0 test/boo.rb
oj-0.9.0 test/boo.rb