msgpack 1.5.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +55 -0
  3. data/README.md +30 -1
  4. data/ext/java/org/msgpack/jruby/Buffer.java +3 -3
  5. data/ext/java/org/msgpack/jruby/ExtensionRegistry.java +11 -20
  6. data/ext/java/org/msgpack/jruby/ExtensionValue.java +1 -1
  7. data/ext/java/org/msgpack/jruby/Factory.java +11 -50
  8. data/ext/java/org/msgpack/jruby/Packer.java +9 -24
  9. data/ext/java/org/msgpack/jruby/Unpacker.java +15 -32
  10. data/ext/msgpack/buffer.c +54 -69
  11. data/ext/msgpack/buffer.h +16 -18
  12. data/ext/msgpack/buffer_class.c +138 -37
  13. data/ext/msgpack/buffer_class.h +1 -0
  14. data/ext/msgpack/compat.h +0 -99
  15. data/ext/msgpack/extconf.rb +25 -39
  16. data/ext/msgpack/factory_class.c +75 -86
  17. data/ext/msgpack/packer.c +12 -39
  18. data/ext/msgpack/packer.h +1 -11
  19. data/ext/msgpack/packer_class.c +73 -99
  20. data/ext/msgpack/packer_class.h +11 -0
  21. data/ext/msgpack/packer_ext_registry.c +31 -28
  22. data/ext/msgpack/packer_ext_registry.h +10 -14
  23. data/ext/msgpack/rbinit.c +1 -1
  24. data/ext/msgpack/rmem.c +3 -4
  25. data/ext/msgpack/sysdep.h +5 -2
  26. data/ext/msgpack/unpacker.c +66 -94
  27. data/ext/msgpack/unpacker.h +13 -12
  28. data/ext/msgpack/unpacker_class.c +64 -80
  29. data/ext/msgpack/unpacker_class.h +11 -0
  30. data/ext/msgpack/unpacker_ext_registry.c +4 -16
  31. data/ext/msgpack/unpacker_ext_registry.h +3 -7
  32. data/lib/msgpack/buffer.rb +9 -0
  33. data/lib/msgpack/factory.rb +90 -63
  34. data/lib/msgpack/packer.rb +10 -1
  35. data/lib/msgpack/unpacker.rb +14 -1
  36. data/lib/msgpack/version.rb +1 -1
  37. data/lib/msgpack.rb +1 -0
  38. data/msgpack.gemspec +7 -3
  39. metadata +33 -56
  40. data/.github/workflows/ci.yaml +0 -57
  41. data/.gitignore +0 -23
  42. data/.rubocop.yml +0 -36
  43. data/Gemfile +0 -9
  44. data/Rakefile +0 -70
  45. data/appveyor.yml +0 -18
  46. data/bench/pack.rb +0 -23
  47. data/bench/pack_log.rb +0 -33
  48. data/bench/pack_log_long.rb +0 -65
  49. data/bench/pack_symbols.rb +0 -28
  50. data/bench/run.sh +0 -14
  51. data/bench/run_long.sh +0 -35
  52. data/bench/run_symbols.sh +0 -26
  53. data/bench/unpack.rb +0 -21
  54. data/bench/unpack_log.rb +0 -34
  55. data/bench/unpack_log_long.rb +0 -67
  56. data/doclib/msgpack/buffer.rb +0 -193
  57. data/doclib/msgpack/core_ext.rb +0 -101
  58. data/doclib/msgpack/error.rb +0 -19
  59. data/doclib/msgpack/extension_value.rb +0 -9
  60. data/doclib/msgpack/factory.rb +0 -145
  61. data/doclib/msgpack/packer.rb +0 -209
  62. data/doclib/msgpack/time.rb +0 -22
  63. data/doclib/msgpack/timestamp.rb +0 -44
  64. data/doclib/msgpack/unpacker.rb +0 -183
  65. data/doclib/msgpack.rb +0 -87
  66. data/msgpack.org.md +0 -46
  67. data/spec/bigint_spec.rb +0 -26
  68. data/spec/cases.json +0 -1
  69. data/spec/cases.msg +0 -0
  70. data/spec/cases_compact.msg +0 -0
  71. data/spec/cases_spec.rb +0 -39
  72. data/spec/cruby/buffer_io_spec.rb +0 -255
  73. data/spec/cruby/buffer_packer.rb +0 -29
  74. data/spec/cruby/buffer_spec.rb +0 -575
  75. data/spec/cruby/buffer_unpacker.rb +0 -19
  76. data/spec/cruby/unpacker_spec.rb +0 -70
  77. data/spec/ext_value_spec.rb +0 -99
  78. data/spec/exttypes.rb +0 -51
  79. data/spec/factory_spec.rb +0 -654
  80. data/spec/format_spec.rb +0 -301
  81. data/spec/jruby/benchmarks/shootout_bm.rb +0 -73
  82. data/spec/jruby/benchmarks/symbolize_keys_bm.rb +0 -25
  83. data/spec/jruby/unpacker_spec.rb +0 -186
  84. data/spec/msgpack_spec.rb +0 -214
  85. data/spec/pack_spec.rb +0 -61
  86. data/spec/packer_spec.rb +0 -575
  87. data/spec/random_compat.rb +0 -24
  88. data/spec/spec_helper.rb +0 -65
  89. data/spec/timestamp_spec.rb +0 -159
  90. data/spec/unpack_spec.rb +0 -57
  91. data/spec/unpacker_spec.rb +0 -847
data/lib/msgpack.rb CHANGED
@@ -7,6 +7,7 @@ else
7
7
  require "msgpack/msgpack"
8
8
  end
9
9
 
10
+ require "msgpack/buffer"
10
11
  require "msgpack/packer"
11
12
  require "msgpack/unpacker"
12
13
  require "msgpack/factory"
data/msgpack.gemspec CHANGED
@@ -12,19 +12,23 @@ Gem::Specification.new do |s|
12
12
  s.homepage = "http://msgpack.org/"
13
13
  s.require_paths = ["lib"]
14
14
  if /java/ =~ RUBY_PLATFORM
15
- s.files = Dir['lib/**/*.rb', 'lib/**/*.jar']
15
+ s.files = Dir['lib/**/*.rb', 'lib/**/*.jar', 'LICENSE']
16
16
  s.platform = Gem::Platform.new('java')
17
17
  else
18
- s.files = `git ls-files`.split("\n")
18
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features|bench|doclib|msgpack.org.md|Gemfile|Rakefile)|\.(?:git|circleci|rubocop)|appveyor)})
20
+ end
19
21
  s.extensions = ["ext/msgpack/extconf.rb"]
20
22
  end
21
23
 
22
- s.required_ruby_version = ">= 2.4"
24
+ s.required_ruby_version = ">= 2.5"
23
25
 
24
26
  s.add_development_dependency 'bundler'
25
27
  s.add_development_dependency 'rake'
26
28
  s.add_development_dependency 'rake-compiler', ['>= 1.1.9']
27
29
  s.add_development_dependency 'rspec', ['~> 3.3']
30
+ s.add_development_dependency 'ruby_memcheck'
28
31
  s.add_development_dependency 'yard'
29
32
  s.add_development_dependency 'json'
33
+ s.add_development_dependency 'benchmark-ips', ['~> 2.10.0']
30
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-04-07 00:00:00.000000000 Z
13
+ date: 2023-07-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -68,6 +68,20 @@ dependencies:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
70
  version: '3.3'
71
+ - !ruby/object:Gem::Dependency
72
+ name: ruby_memcheck
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
71
85
  - !ruby/object:Gem::Dependency
72
86
  name: yard
73
87
  requirement: !ruby/object:Gem::Requirement
@@ -96,6 +110,20 @@ dependencies:
96
110
  - - ">="
97
111
  - !ruby/object:Gem::Version
98
112
  version: '0'
113
+ - !ruby/object:Gem::Dependency
114
+ name: benchmark-ips
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: 2.10.0
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: 2.10.0
99
127
  description: MessagePack is a binary-based efficient object serialization library.
100
128
  It enables to exchange structured objects between many languages like JSON. But
101
129
  unlike JSON, it is very fast and small.
@@ -108,35 +136,9 @@ extensions:
108
136
  - ext/msgpack/extconf.rb
109
137
  extra_rdoc_files: []
110
138
  files:
111
- - ".github/workflows/ci.yaml"
112
- - ".gitignore"
113
- - ".rubocop.yml"
114
139
  - ChangeLog
115
- - Gemfile
116
140
  - LICENSE
117
141
  - README.md
118
- - Rakefile
119
- - appveyor.yml
120
- - bench/pack.rb
121
- - bench/pack_log.rb
122
- - bench/pack_log_long.rb
123
- - bench/pack_symbols.rb
124
- - bench/run.sh
125
- - bench/run_long.sh
126
- - bench/run_symbols.sh
127
- - bench/unpack.rb
128
- - bench/unpack_log.rb
129
- - bench/unpack_log_long.rb
130
- - doclib/msgpack.rb
131
- - doclib/msgpack/buffer.rb
132
- - doclib/msgpack/core_ext.rb
133
- - doclib/msgpack/error.rb
134
- - doclib/msgpack/extension_value.rb
135
- - doclib/msgpack/factory.rb
136
- - doclib/msgpack/packer.rb
137
- - doclib/msgpack/time.rb
138
- - doclib/msgpack/timestamp.rb
139
- - doclib/msgpack/unpacker.rb
140
142
  - ext/java/org/msgpack/jruby/Buffer.java
141
143
  - ext/java/org/msgpack/jruby/Decoder.java
142
144
  - ext/java/org/msgpack/jruby/Encoder.java
@@ -177,6 +179,7 @@ files:
177
179
  - ext/msgpack/unpacker_ext_registry.h
178
180
  - lib/msgpack.rb
179
181
  - lib/msgpack/bigint.rb
182
+ - lib/msgpack/buffer.rb
180
183
  - lib/msgpack/core_ext.rb
181
184
  - lib/msgpack/factory.rb
182
185
  - lib/msgpack/packer.rb
@@ -186,32 +189,6 @@ files:
186
189
  - lib/msgpack/unpacker.rb
187
190
  - lib/msgpack/version.rb
188
191
  - msgpack.gemspec
189
- - msgpack.org.md
190
- - spec/bigint_spec.rb
191
- - spec/cases.json
192
- - spec/cases.msg
193
- - spec/cases_compact.msg
194
- - spec/cases_spec.rb
195
- - spec/cruby/buffer_io_spec.rb
196
- - spec/cruby/buffer_packer.rb
197
- - spec/cruby/buffer_spec.rb
198
- - spec/cruby/buffer_unpacker.rb
199
- - spec/cruby/unpacker_spec.rb
200
- - spec/ext_value_spec.rb
201
- - spec/exttypes.rb
202
- - spec/factory_spec.rb
203
- - spec/format_spec.rb
204
- - spec/jruby/benchmarks/shootout_bm.rb
205
- - spec/jruby/benchmarks/symbolize_keys_bm.rb
206
- - spec/jruby/unpacker_spec.rb
207
- - spec/msgpack_spec.rb
208
- - spec/pack_spec.rb
209
- - spec/packer_spec.rb
210
- - spec/random_compat.rb
211
- - spec/spec_helper.rb
212
- - spec/timestamp_spec.rb
213
- - spec/unpack_spec.rb
214
- - spec/unpacker_spec.rb
215
192
  homepage: http://msgpack.org/
216
193
  licenses:
217
194
  - Apache 2.0
@@ -224,14 +201,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
201
  requirements:
225
202
  - - ">="
226
203
  - !ruby/object:Gem::Version
227
- version: '2.4'
204
+ version: '2.5'
228
205
  required_rubygems_version: !ruby/object:Gem::Requirement
229
206
  requirements:
230
207
  - - ">="
231
208
  - !ruby/object:Gem::Version
232
209
  version: '0'
233
210
  requirements: []
234
- rubygems_version: 3.3.3
211
+ rubygems_version: 3.3.7
235
212
  signing_key:
236
213
  specification_version: 4
237
214
  summary: MessagePack, a binary-based efficient data interchange format.
@@ -1,57 +0,0 @@
1
- name: ci
2
-
3
- on:
4
- pull_request:
5
- branches: '*'
6
- push:
7
- branches:
8
- - master
9
- - main
10
- - 'release-*'
11
-
12
- jobs:
13
- mri:
14
- strategy:
15
- fail-fast: false
16
- matrix:
17
- os: [ubuntu, macos, windows]
18
- ruby: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1']
19
- runs-on: ${{ matrix.os }}-latest
20
- steps:
21
- - uses: actions/checkout@v2
22
- - uses: ruby/setup-ruby@v1
23
- with:
24
- ruby-version: ${{ matrix.ruby }}
25
- bundler-cache: true # 'bundle install' and cache
26
- - run: bundle exec rake
27
-
28
- jruby:
29
- strategy:
30
- fail-fast: false
31
- matrix:
32
- os: [ubuntu]
33
- ruby: ['jruby-9.2.19.0', 'jruby-9.3.3.0']
34
- runs-on: ${{ matrix.os }}-latest
35
- steps:
36
- - uses: actions/checkout@v2
37
- - uses: ruby/setup-ruby@v1
38
- with:
39
- ruby-version: ${{ matrix.ruby }}
40
- bundler-cache: true # 'bundle install' and cache
41
- - run: bundle exec rake
42
-
43
- head-versions:
44
- continue-on-error: true
45
- strategy:
46
- fail-fast: false
47
- matrix:
48
- os: [ubuntu]
49
- ruby: ['ruby-head', 'jruby-head', 'truffleruby']
50
- runs-on: ${{ matrix.os }}-latest
51
- steps:
52
- - uses: actions/checkout@v2
53
- - uses: ruby/setup-ruby@v1
54
- with:
55
- ruby-version: ${{ matrix.ruby }}
56
- bundler-cache: true # 'bundle install' and cache
57
- - run: bundle exec rake || echo "failed, but ignore it"
data/.gitignore DELETED
@@ -1,23 +0,0 @@
1
- *.o
2
- *.so
3
- *.bundle
4
- *.gem
5
- *.class
6
- *.jar
7
- doc
8
- .yardoc
9
- .bundle
10
- Gemfile*
11
- pkg
12
- test/debug.log
13
- *~
14
- *.swp
15
- /rdoc
16
- tmp
17
- .classpath
18
- .project
19
- .settings
20
- /nbproject/private/
21
- coverage/
22
- .idea/
23
- .ruby-version
data/.rubocop.yml DELETED
@@ -1,36 +0,0 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2015-03-09 17:42:55 +0100 using RuboCop version 0.29.1.
3
- # The point is for the user to remove these configuration records
4
- # one by one as the offenses are removed from the code base.
5
- # Note that changes in the inspected code, or installation of new
6
- # versions of RuboCop, may require this file to be generated again.
7
-
8
- AllCops:
9
- TargetRubyVersion: 2.4
10
-
11
- # Offense count: 3
12
- Lint/AmbiguousOperator:
13
- Enabled: false
14
-
15
- # Offense count: 1
16
- # Configuration parameters: AllowSafeAssignment.
17
- Lint/AssignmentInCondition:
18
- Enabled: false
19
-
20
- # Offense count: 1
21
- Security/Eval:
22
- Enabled: false
23
-
24
- # Offense count: 3
25
- # Cop supports --auto-correct.
26
- Lint/UnusedBlockArgument:
27
- Enabled: false
28
-
29
- # Offense count: 35
30
- # Cop supports --auto-correct.
31
- Lint/UnusedMethodArgument:
32
- Enabled: false
33
-
34
- # Offense count: 128
35
- Lint/Void:
36
- Enabled: false
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source 'https://rubygems.org/'
2
-
3
- gemspec
4
-
5
- ## enable this line to run benchmarks
6
- # gem "viiite"
7
-
8
- gem "rubocop", "~> 0.82.0"
9
- gem "simplecov"
data/Rakefile DELETED
@@ -1,70 +0,0 @@
1
-
2
- require 'bundler'
3
- Bundler::GemHelper.install_tasks
4
-
5
- require 'fileutils'
6
-
7
- require 'rspec/core'
8
- require 'rspec/core/rake_task'
9
- require 'yard'
10
-
11
- task :spec => :compile
12
-
13
- desc 'Run RSpec code examples and measure coverage'
14
- task :coverage do |t|
15
- ENV['SIMPLE_COV'] = '1'
16
- Rake::Task["spec"].invoke
17
- end
18
-
19
- desc 'Generate YARD document'
20
- YARD::Rake::YardocTask.new(:doc) do |t|
21
- t.files = ['lib/msgpack/version.rb','doclib/**/*.rb']
22
- t.options = []
23
- t.options << '--debug' << '--verbose' if $trace
24
- end
25
-
26
- spec = eval File.read("msgpack.gemspec")
27
-
28
- if RUBY_PLATFORM =~ /java/
29
- require 'rake/javaextensiontask'
30
-
31
- Rake::JavaExtensionTask.new('msgpack', spec) do |ext|
32
- ext.ext_dir = 'ext/java'
33
- jruby_home = RbConfig::CONFIG['prefix']
34
- jars = ["#{jruby_home}/lib/jruby.jar"]
35
- ext.classpath = jars.map { |x| File.expand_path(x) }.join(':')
36
- ext.lib_dir = File.join(*['lib', 'msgpack', ENV['FAT_DIR']].compact)
37
- ext.release = '8'
38
- end
39
- else
40
- require 'rake/extensiontask'
41
-
42
- Rake::ExtensionTask.new('msgpack', spec) do |ext|
43
- ext.ext_dir = 'ext/msgpack'
44
- ext.cross_compile = true
45
- ext.lib_dir = File.join(*['lib', 'msgpack', ENV['FAT_DIR']].compact)
46
- # cross_platform names are of MRI's platform name
47
- ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
48
- end
49
- end
50
-
51
- test_pattern = case
52
- when RUBY_PLATFORM =~ /java/ then 'spec/{,jruby/}*_spec.rb'
53
- when RUBY_ENGINE =~ /rbx/ then 'spec/*_spec.rb'
54
- else 'spec/{,cruby/}*_spec.rb' # MRI
55
- end
56
- RSpec::Core::RakeTask.new(:spec) do |t|
57
- t.rspec_opts = ["-c", "-f progress"]
58
- t.rspec_opts << "-Ilib"
59
- t.pattern = test_pattern
60
- t.verbose = true
61
- end
62
-
63
- namespace :build do
64
- desc 'Build gem for JRuby after cleaning'
65
- task :java => [:clean, :spec, :build]
66
- end
67
-
68
- CLEAN.include('lib/msgpack/msgpack.*')
69
-
70
- task :default => [:spec, :build, :doc]
data/appveyor.yml DELETED
@@ -1,18 +0,0 @@
1
- ---
2
- install:
3
- - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
4
- - ruby --version
5
- - gem --version
6
- - bundle install
7
- build: off
8
- test_script:
9
- - bundle exec rake -rdevkit
10
-
11
- environment:
12
- matrix:
13
- - ruby_version: "200"
14
- - ruby_version: "200-x64"
15
- - ruby_version: "21"
16
- - ruby_version: "21-x64"
17
- - ruby_version: "22"
18
- - ruby_version: "22-x64"
data/bench/pack.rb DELETED
@@ -1,23 +0,0 @@
1
- require 'viiite'
2
- require 'msgpack'
3
-
4
- data = { 'hello' => 'world', 'nested' => ['structure', {value: 42}] }
5
- data_sym = { hello: 'world', nested: ['structure', {value: 42}] }
6
-
7
- data = MessagePack.pack(:hello => 'world', :nested => ['structure', {:value => 42}])
8
-
9
- Viiite.bench do |b|
10
- b.range_over([10_000, 100_000, 1000_000], :runs) do |runs|
11
- b.report(:strings) do
12
- runs.times do
13
- MessagePack.pack(data)
14
- end
15
- end
16
-
17
- b.report(:symbols) do
18
- runs.times do
19
- MessagePack.pack(data_sym)
20
- end
21
- end
22
- end
23
- end
data/bench/pack_log.rb DELETED
@@ -1,33 +0,0 @@
1
- require 'viiite'
2
- require 'msgpack'
3
-
4
- data_plain = { '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
- data_structure = {
6
- 'remote_host' => '127.0.0.1',
7
- 'remote_user' => '-',
8
- 'date' => '10/Oct/2000:13:55:36 -0700',
9
- 'request' => 'GET /apache_pb.gif HTTP/1.0',
10
- 'method' => 'GET',
11
- 'path' => '/apache_pb.gif',
12
- 'protocol' => 'HTTP/1.0',
13
- 'status' => 200,
14
- 'bytes' => 2326,
15
- 'referer' => 'http://www.example.com/start.html',
16
- 'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
17
- }
18
-
19
- Viiite.bench do |b|
20
- b.range_over([10_000, 100_000, 1000_000], :runs) do |runs|
21
- b.report(:plain) do
22
- runs.times do
23
- MessagePack.pack(data_plain)
24
- end
25
- end
26
-
27
- b.report(:structure) do
28
- runs.times do
29
- MessagePack.pack(data_structure)
30
- end
31
- end
32
- end
33
- end
@@ -1,65 +0,0 @@
1
- # viiite report --regroup bench,threads bench/pack_log_long.rb
2
-
3
- require 'viiite'
4
- require 'msgpack'
5
-
6
- data_plain = { '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)"' }
7
- data_structure = {
8
- 'remote_host' => '127.0.0.1',
9
- 'remote_user' => '-',
10
- 'date' => '10/Oct/2000:13:55:36 -0700',
11
- 'request' => 'GET /apache_pb.gif HTTP/1.0',
12
- 'method' => 'GET',
13
- 'path' => '/apache_pb.gif',
14
- 'protocol' => 'HTTP/1.0',
15
- 'status' => 200,
16
- 'bytes' => 2326,
17
- 'referer' => 'http://www.example.com/start.html',
18
- 'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
19
- }
20
-
21
- seconds = 3600 # 1 hour
22
-
23
- Viiite.bench do |b|
24
- b.range_over([1, 2, 4, 8, 16], :threads) do |threads|
25
- b.report(:plain) do
26
- ths = []
27
- end_at = Time.now + seconds
28
- threads.times do
29
- t = Thread.new do
30
- packs = 0
31
- while Time.now < end_at
32
- 10000.times do
33
- MessagePack.pack(data_plain)
34
- end
35
- packs += 10000
36
- end
37
- packs
38
- end
39
- ths.push t
40
- end
41
- sum = ths.reduce(0){|r,t| r + t.value }
42
- puts "MessagePack.pack, plain, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
43
- end
44
-
45
- b.report(:structure) do
46
- ths = []
47
- end_at = Time.now + seconds
48
- threads.times do
49
- t = Thread.new do
50
- packs = 0
51
- while Time.now < end_at
52
- 10000.times do
53
- MessagePack.pack(data_structure)
54
- end
55
- packs += 10000
56
- end
57
- packs
58
- end
59
- ths.push t
60
- end
61
- sum = ths.reduce(0){|r,t| r + t.value }
62
- puts "MessagePack.pack, structured, #{threads} threads: #{sum} times, #{sum / seconds} times/second."
63
- end
64
- end
65
- end
@@ -1,28 +0,0 @@
1
- require 'viiite'
2
- require 'msgpack'
3
-
4
- data = :symbol
5
-
6
- Viiite.bench do |b|
7
- b.variation_point :branch, `git rev-parse --abbrev-ref HEAD`
8
-
9
- b.range_over([:symbol, :none], :reg_type) do |reg_type|
10
- packer = MessagePack::Packer.new
11
- packer.register_type(0x00, Symbol, :to_msgpack_ext) if reg_type == :symbol
12
-
13
- b.range_over([100_000, 1_000_000, 10_000_000], :count) do |count|
14
- packer.clear
15
- b.report(:multi_run) do
16
- count.times do
17
- packer.pack(data)
18
- end
19
- end
20
-
21
- packer.clear
22
- items_data = [].fill(data, 0, count)
23
- b.report(:large_run) do
24
- packer.pack(items_data)
25
- end
26
- end
27
- end
28
- end
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