Skip to content

Instantly share code, notes, and snippets.

@frsyuki
Created April 18, 2019 06:48
Show Gist options
  • Save frsyuki/68f07bda64594eaf2ed431a41d0a2458 to your computer and use it in GitHub Desktop.
Save frsyuki/68f07bda64594eaf2ed431a41d0a2458 to your computer and use it in GitHub Desktop.

No optimization:

        user     system      total        real
0.1kb   1.204809   0.005060   1.209869 (  1.210884)
1kb     1.309668   0.004896   1.314564 (  1.315971)
10kb    2.674302   0.077470   2.751772 (  2.755213)
100kb  29.982771  22.375113  52.357884 ( 52.386822)
500kb 122.625423  82.284026 204.909449 (205.018250)
600kb   1.006700   0.003676   1.010376 (  1.010782)

With feed_reference optimization:

            user     system      total        real
0.1kb   1.083846   0.003683   1.087529 (  1.088513)
1kb     1.094858   0.005324   1.100182 (  1.101378)
10kb    1.084737   0.003666   1.088403 (  1.089650)
100kb   1.087578   0.003564   1.091142 (  1.092555)
500kb   1.123068   0.003202   1.126270 (  1.127866)
600kb   1.164886   0.004079   1.168965 (  1.170279)

Benchmark environment:

  • ruby-2.6.2p47
  • msgpack-1.2.9
  • Mac OS X 10.14.4
  • 2.9GHz Intel Core i9 CPU
  • 32GB 2400MHz DDR4 memory
require 'msgpack'
require 'benchmark'
Benchmark.bmbm do |x|
[0.1, 1, 10, 100, 500, 600].each do |kb|
msg = ['a' * kb * 1024]
bin = MessagePack.pack(msg)
x.report("#{kb}kb") do
for a in 1..1000000 do
MessagePack.unpack(bin)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment