msgpack 1.5.2 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
data/bench/run.sh DELETED
@@ -1,14 +0,0 @@
1
- #!/bin/sh
2
-
3
- # prerequisites
4
- # $ rbenv shell 2.2.1 (or jruby-x.x.x or ...)
5
- # $ rake install
6
-
7
- echo "pack"
8
- viiite report --regroup bench,runs bench/pack.rb
9
- echo "unpack"
10
- viiite report --regroup bench,runs bench/unpack.rb
11
- echo "pack log"
12
- viiite report --regroup bench,runs bench/pack_log.rb
13
- echo "unpack log"
14
- viiite report --regroup bench,runs bench/unpack_log.rb
data/bench/run_long.sh DELETED
@@ -1,35 +0,0 @@
1
- #!/bin/sh
2
-
3
- # prerequisites
4
- # $ sudo apt-get install sysstat
5
- # $ rbenv shell 2.2.1 (or jruby-x.x.x or ...)
6
- # $ rake install
7
-
8
- # 60 * 600 : 60*60 * 5[threads] * 2[bench]
9
-
10
- ruby -v
11
-
12
- echo "pack log long"
13
- viiite report --regroup bench,threads bench/pack_log_long.rb &
14
- sar -o pack_log_long.sar -r 60 600 > /dev/null 2>&1 &
15
-
16
- declare -i i=0
17
- while [ $i -lt 600 ]; do
18
- ps auxww | grep ruby | grep -v grep | awk '{print $5,$6;}' >> pack_log_long.mem.txt
19
- i=i+1
20
- sleep 60
21
- done
22
-
23
- sleep 120 # cool down
24
-
25
- echo "unpack log long"
26
- viiite report --regroup bench,threads bench/unpack_log_long.rb &
27
- sar -o unpack_log_long.sar -r 60 600 > /dev/null 2>&1 &
28
-
29
- i=0
30
- while [ $i -lt 600 ]; do
31
- ps auxww | grep ruby | grep -v grep | awk '{print $5,$6;}' >> pack_log_long.mem.txt
32
- i=i+1
33
- sleep 60
34
- done
35
-
data/bench/run_symbols.sh DELETED
@@ -1,26 +0,0 @@
1
- #!/bin/sh
2
-
3
- # so master and this branch have the benchmark file in any case
4
- cp bench/pack_symbols.rb bench/pack_symbols_tmp.rb
5
-
6
- benchmark=""
7
- current_branch=`git rev-parse --abbrev-ref HEAD`
8
-
9
- for branch in master $current_branch; do
10
- echo "Testing branch $branch"
11
- git checkout $branch
12
-
13
- echo "Installing gem..."
14
- rake install
15
-
16
- echo "Running benchmark..."
17
- if [ "$benchmark" ]; then
18
- benchmark+=$'\n'
19
- fi
20
- benchmark+=$(viiite run bench/pack_symbols_tmp.rb)
21
- echo
22
- done
23
-
24
- rm bench/pack_symbols_tmp.rb
25
-
26
- echo "$benchmark" | viiite report --regroup bench,reg_type,count,branch
data/bench/unpack.rb DELETED
@@ -1,21 +0,0 @@
1
- require 'viiite'
2
- require 'msgpack'
3
-
4
- data = MessagePack.pack(:hello => 'world', :nested => ['structure', {:value => 42}])
5
-
6
- Viiite.bench do |b|
7
- b.range_over([10_000, 100_000, 1000_000], :runs) do |runs|
8
- b.report(:strings) do
9
- runs.times do
10
- MessagePack.unpack(data)
11
- end
12
- end
13
-
14
- b.report(:symbols) do
15
- options = {:symbolize_keys => true}
16
- runs.times do
17
- MessagePack.unpack(data, options)
18
- end
19
- end
20
- end
21
- end
data/bench/unpack_log.rb DELETED
@@ -1,34 +0,0 @@
1
- require 'viiite'
2
- require 'msgpack'
3
-
4
- 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)"' })
5
-
6
- data_structure = MessagePack.pack({
7
- 'remote_host' => '127.0.0.1',
8
- 'remote_user' => '-',
9
- 'date' => '10/Oct/2000:13:55:36 -0700',
10
- 'request' => 'GET /apache_pb.gif HTTP/1.0',
11
- 'method' => 'GET',
12
- 'path' => '/apache_pb.gif',
13
- 'protocol' => 'HTTP/1.0',
14
- 'status' => 200,
15
- 'bytes' => 2326,
16
- 'referer' => 'http://www.example.com/start.html',
17
- 'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
18
- })
19
-
20
- Viiite.bench do |b|
21
- b.range_over([10_000, 100_000, 1000_000], :runs) do |runs|
22
- b.report(:plain) do
23
- runs.times do
24
- MessagePack.unpack(data_plain)
25
- end
26
- end
27
-
28
- b.report(:structure) do
29
- runs.times do
30
- MessagePack.unpack(data_structure)
31
- end
32
- end
33
- end
34
- end
@@ -1,67 +0,0 @@
1
- # viiite report --regroup bench,threads bench/pack_log_long.rb
2
-
3
- require 'viiite'
4
- require 'msgpack'
5
-
6
- data_plain = MessagePack.pack({
7
- '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)"'
8
- })
9
- data_structure = MessagePack.pack({
10
- 'remote_host' => '127.0.0.1',
11
- 'remote_user' => '-',
12
- 'date' => '10/Oct/2000:13:55:36 -0700',
13
- 'request' => 'GET /apache_pb.gif HTTP/1.0',
14
- 'method' => 'GET',
15
- 'path' => '/apache_pb.gif',
16
- 'protocol' => 'HTTP/1.0',
17
- 'status' => 200,
18
- 'bytes' => 2326,
19
- 'referer' => 'http://www.example.com/start.html',
20
- 'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
21
- })
22
-
23
- seconds = 3600 # 1 hour
24
-
25
- Viiite.bench do |b|
26
- b.range_over([1, 2, 4, 8, 16], :threads) do |threads|
27
- b.report(:plain) do
28
- ths = []
29
- end_at = Time.now + seconds
30
- threads.times do
31
- t = Thread.new do
32
- packs = 0
33
- while Time.now < end_at
34
- 10000.times do
35
- MessagePack.unpack(data_plain)
36
- end
37
- packs += 10000
38
- end
39
- packs
40
- end
41
- ths.push t
42
- end
43
- sum = ths.reduce(0){|r,t| r + t.value }
44
- puts "MessagePack.unpack, plain, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
45
- end
46
-
47
- b.report(:structure) do
48
- ths = []
49
- end_at = Time.now + seconds
50
- threads.times do
51
- t = Thread.new do
52
- packs = 0
53
- while Time.now < end_at
54
- 10000.times do
55
- MessagePack.unpack(data_structure)
56
- end
57
- packs += 10000
58
- end
59
- packs
60
- end
61
- ths.push t
62
- end
63
- sum = ths.reduce(0){|r,t| r + t.value }
64
- puts "MessagePack.unpack, structured, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
65
- end
66
- end
67
- end