Sha256: 50faa0c9905fa4fabc521bbb5a14b5c612f059aacc43c5d7177ac4ab79f575bb

Contents?: true

Size: 1.83 KB

Versions: 106

Compression:

Stored size: 1.83 KB

Contents

# viiite report --regroup bench,threads bench/pack_log_long.rb

require 'viiite'
require 'msgpack'

data_plain = MessagePack.pack({
    'message' => '127.0.0.1 - - [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326 "http://www.example.com/start.html" "Mozilla/4.08 [en] (Win98; I ;Nav)"'
})
data_structure = MessagePack.pack({
  'remote_host' => '127.0.0.1',
  'remote_user' => '-',
  'date' => '10/Oct/2000:13:55:36 -0700',
  'request' => 'GET /apache_pb.gif HTTP/1.0',
  'method' => 'GET',
  'path' => '/apache_pb.gif',
  'protocol' => 'HTTP/1.0',
  'status' => 200,
  'bytes' => 2326,
  'referer' => 'http://www.example.com/start.html',
  'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
})

seconds = 3600 # 1 hour

Viiite.bench do |b|
  b.range_over([1, 2, 4, 8, 16], :threads) do |threads|
    b.report(:plain) do
      ths = []
      end_at = Time.now + seconds
      threads.times do
        t = Thread.new do
          packs = 0
          while Time.now < end_at
            10000.times do
              MessagePack.unpack(data_plain)
            end
            packs += 10000
          end
          packs
        end
        ths.push t
      end
      sum = ths.reduce(0){|r,t| r + t.value }
      puts "MessagePack.unpack, plain, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
    end

    b.report(:structure) do
      ths = []
      end_at = Time.now + seconds
      threads.times do
        t = Thread.new do
          packs = 0
          while Time.now < end_at
            10000.times do
              MessagePack.unpack(data_structure)
            end
            packs += 10000
          end
          packs
        end
        ths.push t
      end
      sum = ths.reduce(0){|r,t| r + t.value }
      puts "MessagePack.unpack, structured, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
    end
  end
end

Version data entries

106 entries across 106 versions & 3 rubygems

Version Path
msgpack-1.5.3 bench/unpack_log_long.rb
msgpack-1.5.2 bench/unpack_log_long.rb
msgpack-1.5.1 bench/unpack_log_long.rb
msgpack-1.5.0 bench/unpack_log_long.rb
msgpack-1.4.5 bench/unpack_log_long.rb
msgpack-1.4.4 bench/unpack_log_long.rb
msgpack-1.4.3 bench/unpack_log_long.rb
msgpack-1.4.2 bench/unpack_log_long.rb
msgpack-1.4.0.pre1 bench/unpack_log_long.rb
msgpack-1.3.3-x64-mingw32 bench/unpack_log_long.rb
msgpack-1.3.3-x86-mingw32 bench/unpack_log_long.rb
msgpack-1.3.3 bench/unpack_log_long.rb
msgpack-1.3.2-x64-mingw32 bench/unpack_log_long.rb
msgpack-1.3.2-x86-mingw32 bench/unpack_log_long.rb
msgpack-1.3.2 bench/unpack_log_long.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/msgpack-1.3.1/bench/unpack_log_long.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/msgpack-1.3.1/bench/unpack_log_long.rb
msgpack-1.3.1-x64-mingw32 bench/unpack_log_long.rb
msgpack-1.3.1-x86-mingw32 bench/unpack_log_long.rb
msgpack-1.3.1 bench/unpack_log_long.rb