File: symbolize_keys_bm.rb

package info (click to toggle)
ruby-msgpack 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 844 kB
  • ctags: 1,033
  • sloc: ansic: 4,022; ruby: 3,378; java: 1,727; sh: 45; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 468 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# encoding: utf-8

$: << File.expand_path('../../../lib', __FILE__)

require 'viiite'
require 'msgpack'


iterations = 10_000
data = MessagePack.pack(:hello => 'world', :nested => ['structure', {:value => 42}])

Viiite.bm do |b|
  b.report(:strings) do
    iterations.times do
      MessagePack.unpack(data)
    end
  end

  b.report(:symbols) do
    options = {:symbolize_keys => true}
    iterations.times do
      MessagePack.unpack(data, options)
    end
  end
end