File tree Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,11 @@ def benchmark_encoding(name, ruby_obj)
19
19
puts "== Encoding #{ name } (#{ json_output . size } bytes)"
20
20
21
21
Benchmark . ips do |x |
22
- x . report ( "yajl" ) { Yajl ::Encoder . new . encode ( ruby_obj ) } if RUN [ :yajl ]
23
22
x . report ( "json" ) { JSON . dump ( ruby_obj ) } if RUN [ :json ]
23
+ x . report ( "yajl" ) { Yajl ::Encoder . new . encode ( ruby_obj ) } if RUN [ :yajl ]
24
24
x . report ( "oj" ) { Oj . dump ( ruby_obj ) } if RUN [ :oj ]
25
25
x . report ( "rapidjson" ) { RapidJSON . encode ( ruby_obj ) } if RUN [ :rapidjson ]
26
+ x . compare! ( order : :baseline )
26
27
end
27
28
puts
28
29
end
Original file line number Diff line number Diff line change @@ -19,13 +19,14 @@ def benchmark_parsing(name, json_output)
19
19
puts "== Parsing #{ name } (#{ json_output . size } bytes)"
20
20
21
21
Benchmark . ips do |x |
22
- x . report ( "yajl" ) { Yajl ::Parser . new . parse ( json_output ) } if RUN [ :yajl ]
23
22
x . report ( "json" ) { JSON . parse ( json_output ) } if RUN [ :json ]
23
+ x . report ( "yajl" ) { Yajl ::Parser . new . parse ( json_output ) } if RUN [ :yajl ]
24
24
x . report ( "oj" ) { Oj . load ( json_output ) } if RUN [ :oj ]
25
25
x . report ( "oj strict" ) { Oj . strict_load ( json_output ) } if RUN [ :oj ]
26
26
x . report ( "Oj::Parser" ) { Oj ::Parser . usual . parse ( json_output ) } if RUN [ :oj ]
27
27
x . report ( "fast_jsonparser" ) { FastJsonparser . parse ( json_output ) } if RUN [ :fast_jsonparser ]
28
28
x . report ( "rapidjson" ) { RapidJSON . parse ( json_output ) } if RUN [ :rapidjson ]
29
+ x . compare! ( order : :baseline )
29
30
end
30
31
puts
31
32
end
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ def benchmark_parsing(name, json_output)
21
21
Benchmark . ips do |x |
22
22
x . report ( "parse" ) { RapidJSON . parse ( json_output ) } if RUN [ :parse ]
23
23
x . report ( "validate" ) { RapidJSON . valid_json? ( json_output ) } if RUN [ :validate ]
24
+ x . compare! ( order : :baseline )
24
25
end
25
26
puts
26
27
end
You can’t perform that action at this time.
0 commit comments