Last active
December 19, 2015 02:09
-
-
Save jedisct1/5880964 to your computer and use it in GitHub Desktop.
msgpack benchmark results
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.4.0] | |
user system total real | |
YAML 29.190000 1.150000 30.340000 ( 31.303681) | |
JSON 1.780000 0.050000 1.830000 ( 2.357544) | |
Marshal 1.300000 0.020000 1.320000 ( 1.781964) | |
MessagePack 0.520000 0.160000 0.680000 ( 0.692523) | |
jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on Java HotSpot(TM) 64-Bit Server VM 1.7.0_17-b02 +indy [darwin-x86_64] | |
user system total real | |
YAML 23.290000 0.120000 23.410000 ( 23.356000) | |
JSON 1.190000 0.010000 1.200000 ( 1.158000) | |
Marshal 0.680000 0.000000 0.680000 ( 0.624000) | |
MessagePack 0.450000 0.010000 0.460000 ( 0.450000) | |
require 'benchmark' | |
require 'yaml' | |
require 'json' | |
require 'msgpack' | |
Benchmark.bmbm do |bm| | |
this_many = 100_000 | |
this = {aim: true, | |
nested: {number: 100_000_000, | |
string: 'my life close twice before...'}} | |
bm.report 'YAML' do | |
this_many.times do | |
YAML.load YAML.dump(this) | |
end | |
end | |
bm.report 'JSON' do | |
this_many.times do | |
JSON.parse JSON.generate(this) | |
end | |
end | |
bm.report 'Marshal' do | |
this_many.times do | |
Marshal.load Marshal.dump(this) | |
end | |
end | |
bm.report 'MessagePack' do | |
this_many.times do | |
MessagePack.unpack MessagePack.pack(this) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment