Skip to content

Instantly share code, notes, and snippets.

@frsyuki
Created May 14, 2012 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frsyuki/2692477 to your computer and use it in GitHub Desktop.
Save frsyuki/2692477 to your computer and use it in GitHub Desktop.
* Software
* ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]
* oj-1.2.8
* msgpack-0.4.7
* ox-1.5.7
* json-1.7.3
* Hardware
* MacBook Air 13-inch, Mid 2011
* Intel Core i7 1.8GHz
* 4GB 1333 MHz DDR3
> perf_strict.rb -n -o
--------------------------------------------------------------------------------
Load/Parse Performance
JSON::Ext.parse 10000 times in 0.331 seconds or 30195.242 parse/sec.
JSON::Pure.parse 10000 times in 3.233 seconds or 3093.430 parse/sec.
Oj:compat.load 10000 times in 0.186 seconds or 53812.624 load/sec.
Oj.load 10000 times in 0.198 seconds or 50583.736 load/sec.
Yajl.parse 10000 times in 0.313 seconds or 31934.700 parse/sec.
Ox.load 10000 times in 0.213 seconds or 46927.207 load/sec.
MessagePack.unpack 10000 times in 0.184 seconds or 54277.325 unpack/sec.
Summary:
System time (secs) rate (ops/sec)
----------- ----------- --------------
MessagePack 0.184 54277.325
Oj:compat 0.186 53812.624
Oj 0.198 50583.736
Ox 0.213 46927.207
Yajl 0.313 31934.700
JSON::Ext 0.331 30195.242
JSON::Pure 3.233 3093.430
Comparison Matrix
(performance factor, 2.0 means row is twice as fast as column)
MessagePack Oj:compat Oj Ox Yajl JSON::Ext JSON::Pure
----------- ----------- ----------- ----------- ----------- ----------- ----------- -----------
MessagePack 1.00 1.01 1.07 1.16 1.70 1.80 17.55
Oj:compat 0.99 1.00 1.06 1.15 1.69 1.78 17.40
Oj 0.93 0.94 1.00 1.08 1.58 1.68 16.35
Ox 0.86 0.87 0.93 1.00 1.47 1.55 15.17
Yajl 0.59 0.59 0.63 0.68 1.00 1.06 10.32
JSON::Ext 0.56 0.56 0.60 0.64 0.95 1.00 9.76
JSON::Pure 0.06 0.06 0.06 0.07 0.10 0.10 1.00
--------------------------------------------------------------------------------
Dump/Encode/Generate Performance
JSON::Ext.generate 10000 times in 0.590 seconds or 16944.012 generate/sec.
JSON::Pure.generate 10000 times in 1.767 seconds or 5660.629 generate/sec.
Oj.dump 10000 times in 0.150 seconds or 66648.005 dump/sec.
Oj:compat.dump 10000 times in 0.161 seconds or 62184.801 dump/sec.
Yajl.encode 10000 times in 0.126 seconds or 79198.511 encode/sec.
Ox.dump 10000 times in 0.152 seconds or 65939.573 dump/sec.
MessagePack.pack 10000 times in 0.072 seconds or 138159.713 pack/sec.
Summary:
System time (secs) rate (ops/sec)
----------- ----------- --------------
MessagePack 0.072 138159.713
Yajl 0.126 79198.511
Oj 0.150 66648.005
Ox 0.152 65939.573
Oj:compat 0.161 62184.801
JSON::Ext 0.590 16944.012
JSON::Pure 1.767 5660.629
Comparison Matrix
(performance factor, 2.0 means row is twice as fast as column)
MessagePack Yajl Oj Ox Oj:compat JSON::Ext JSON::Pure
----------- ----------- ----------- ----------- ----------- ----------- ----------- -----------
MessagePack 1.00 1.74 2.07 2.10 2.22 8.15 24.41
Yajl 0.57 1.00 1.19 1.20 1.27 4.67 13.99
Oj 0.48 0.84 1.00 1.01 1.07 3.93 11.77
Ox 0.48 0.83 0.99 1.00 1.06 3.89 11.65
Oj:compat 0.45 0.79 0.93 0.94 1.00 3.67 10.99
JSON::Ext 0.12 0.21 0.25 0.26 0.27 1.00 2.99
JSON::Pure 0.04 0.07 0.08 0.09 0.09 0.33 1.00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment