msgpack 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +14 -0
- data/README.md +27 -0
- data/ext/java/org/msgpack/jruby/ExtensionRegistry.java +4 -9
- data/ext/java/org/msgpack/jruby/Factory.java +1 -1
- data/ext/java/org/msgpack/jruby/Packer.java +3 -0
- data/ext/java/org/msgpack/jruby/Unpacker.java +3 -0
- data/ext/msgpack/buffer.c +9 -12
- data/ext/msgpack/buffer.h +2 -10
- data/ext/msgpack/buffer_class.c +4 -4
- data/ext/msgpack/extconf.rb +3 -15
- data/ext/msgpack/factory_class.c +1 -1
- data/ext/msgpack/packer.c +1 -0
- data/ext/msgpack/packer_class.c +9 -19
- data/ext/msgpack/rbinit.c +1 -1
- data/ext/msgpack/rmem.c +3 -4
- data/ext/msgpack/unpacker.c +8 -20
- data/ext/msgpack/unpacker.h +0 -4
- data/ext/msgpack/unpacker_class.c +11 -21
- data/lib/msgpack/buffer.rb +9 -0
- data/lib/msgpack/factory.rb +41 -53
- data/lib/msgpack/packer.rb +4 -0
- data/lib/msgpack/unpacker.rb +4 -0
- data/lib/msgpack/version.rb +1 -1
- data/lib/msgpack.rb +1 -0
- data/msgpack.gemspec +6 -3
- metadata +19 -48
- data/.github/workflows/ci.yaml +0 -57
- data/.gitignore +0 -23
- data/.rubocop.yml +0 -36
- data/Gemfile +0 -9
- data/Rakefile +0 -70
- data/appveyor.yml +0 -18
- data/bench/bench.rb +0 -78
- data/bin/console +0 -8
- data/doclib/msgpack/buffer.rb +0 -193
- data/doclib/msgpack/core_ext.rb +0 -101
- data/doclib/msgpack/error.rb +0 -19
- data/doclib/msgpack/extension_value.rb +0 -9
- data/doclib/msgpack/factory.rb +0 -145
- data/doclib/msgpack/packer.rb +0 -209
- data/doclib/msgpack/time.rb +0 -22
- data/doclib/msgpack/timestamp.rb +0 -44
- data/doclib/msgpack/unpacker.rb +0 -183
- data/doclib/msgpack.rb +0 -87
- data/msgpack.org.md +0 -46
- data/spec/bigint_spec.rb +0 -26
- data/spec/cases.json +0 -1
- data/spec/cases.msg +0 -0
- data/spec/cases_compact.msg +0 -0
- data/spec/cases_spec.rb +0 -39
- data/spec/cruby/buffer_io_spec.rb +0 -255
- data/spec/cruby/buffer_packer.rb +0 -29
- data/spec/cruby/buffer_spec.rb +0 -592
- data/spec/cruby/buffer_unpacker.rb +0 -19
- data/spec/cruby/unpacker_spec.rb +0 -70
- data/spec/ext_value_spec.rb +0 -99
- data/spec/exttypes.rb +0 -51
- data/spec/factory_spec.rb +0 -706
- data/spec/format_spec.rb +0 -301
- data/spec/jruby/benchmarks/shootout_bm.rb +0 -73
- data/spec/jruby/benchmarks/symbolize_keys_bm.rb +0 -25
- data/spec/jruby/unpacker_spec.rb +0 -186
- data/spec/msgpack_spec.rb +0 -214
- data/spec/pack_spec.rb +0 -61
- data/spec/packer_spec.rb +0 -575
- data/spec/random_compat.rb +0 -24
- data/spec/spec_helper.rb +0 -72
- data/spec/timestamp_spec.rb +0 -159
- data/spec/unpack_spec.rb +0 -57
- data/spec/unpacker_spec.rb +0 -869
data/lib/msgpack/factory.rb
CHANGED
@@ -88,33 +88,34 @@ module MessagePack
|
|
88
88
|
|
89
89
|
class Pool
|
90
90
|
if RUBY_ENGINE == "ruby"
|
91
|
-
class
|
91
|
+
class MemberPool
|
92
92
|
def initialize(size, &block)
|
93
93
|
@size = size
|
94
94
|
@new_member = block
|
95
95
|
@members = []
|
96
96
|
end
|
97
97
|
|
98
|
-
def
|
99
|
-
@members.pop || @new_member.call
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
98
|
+
def with
|
99
|
+
member = @members.pop || @new_member.call
|
100
|
+
begin
|
101
|
+
yield member
|
102
|
+
ensure
|
103
|
+
# If the pool is already full, we simply drop the extra member.
|
104
|
+
# This is because contrary to a connection pool, creating an extra instance
|
105
|
+
# is extremely unlikely to cause some kind of resource exhaustion.
|
106
|
+
#
|
107
|
+
# We could cycle the members (keep the newer one) but first It's more work and second
|
108
|
+
# the older member might have been created pre-fork, so it might be at least partially
|
109
|
+
# in shared memory.
|
110
|
+
if member && @members.size < @size
|
111
|
+
member.reset
|
112
|
+
@members << member
|
113
|
+
end
|
113
114
|
end
|
114
115
|
end
|
115
116
|
end
|
116
117
|
else
|
117
|
-
class
|
118
|
+
class MemberPool
|
118
119
|
def initialize(size, &block)
|
119
120
|
@size = size
|
120
121
|
@new_member = block
|
@@ -122,63 +123,50 @@ module MessagePack
|
|
122
123
|
@mutex = Mutex.new
|
123
124
|
end
|
124
125
|
|
125
|
-
def
|
126
|
-
@mutex.synchronize { @members.pop } || @new_member.call
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
member.
|
133
|
-
|
126
|
+
def with
|
127
|
+
member = @mutex.synchronize { @members.pop } || @new_member.call
|
128
|
+
begin
|
129
|
+
yield member
|
130
|
+
ensure
|
131
|
+
member.reset
|
132
|
+
@mutex.synchronize do
|
133
|
+
if member && @members.size < @size
|
134
|
+
@members << member
|
135
|
+
end
|
134
136
|
end
|
135
137
|
end
|
136
138
|
end
|
137
139
|
end
|
138
140
|
end
|
139
141
|
|
140
|
-
class PackerPool < AbstractPool
|
141
|
-
private
|
142
|
-
|
143
|
-
def reset(packer)
|
144
|
-
packer.clear
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
class UnpackerPool < AbstractPool
|
149
|
-
private
|
150
|
-
|
151
|
-
def reset(unpacker)
|
152
|
-
unpacker.reset
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
142
|
def initialize(factory, size, options = nil)
|
157
143
|
options = nil if !options || options.empty?
|
158
144
|
@factory = factory
|
159
|
-
@packers =
|
160
|
-
@unpackers =
|
145
|
+
@packers = MemberPool.new(size) { factory.packer(options).freeze }
|
146
|
+
@unpackers = MemberPool.new(size) { factory.unpacker(options).freeze }
|
161
147
|
end
|
162
148
|
|
163
149
|
def load(data)
|
164
|
-
|
165
|
-
|
166
|
-
unpacker.feed_reference(data)
|
150
|
+
@unpackers.with do |unpacker|
|
151
|
+
unpacker.feed(data)
|
167
152
|
unpacker.full_unpack
|
168
|
-
ensure
|
169
|
-
@unpackers.checkin(unpacker)
|
170
153
|
end
|
171
154
|
end
|
172
155
|
|
173
156
|
def dump(object)
|
174
|
-
|
175
|
-
begin
|
157
|
+
@packers.with do |packer|
|
176
158
|
packer.write(object)
|
177
159
|
packer.full_pack
|
178
|
-
ensure
|
179
|
-
@packers.checkin(packer)
|
180
160
|
end
|
181
161
|
end
|
162
|
+
|
163
|
+
def unpacker(&block)
|
164
|
+
@unpackers.with(&block)
|
165
|
+
end
|
166
|
+
|
167
|
+
def packer(&block)
|
168
|
+
@packers.with(&block)
|
169
|
+
end
|
182
170
|
end
|
183
171
|
end
|
184
172
|
end
|
data/lib/msgpack/packer.rb
CHANGED
data/lib/msgpack/unpacker.rb
CHANGED
data/lib/msgpack/version.rb
CHANGED
data/lib/msgpack.rb
CHANGED
data/msgpack.gemspec
CHANGED
@@ -12,19 +12,22 @@ 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("\
|
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.
|
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'
|
30
33
|
s.add_development_dependency 'benchmark-ips', ['~> 2.10.0']
|
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.
|
4
|
+
version: 1.7.0
|
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:
|
13
|
+
date: 2023-03-29 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
|
@@ -122,27 +136,9 @@ extensions:
|
|
122
136
|
- ext/msgpack/extconf.rb
|
123
137
|
extra_rdoc_files: []
|
124
138
|
files:
|
125
|
-
- ".github/workflows/ci.yaml"
|
126
|
-
- ".gitignore"
|
127
|
-
- ".rubocop.yml"
|
128
139
|
- ChangeLog
|
129
|
-
- Gemfile
|
130
140
|
- LICENSE
|
131
141
|
- README.md
|
132
|
-
- Rakefile
|
133
|
-
- appveyor.yml
|
134
|
-
- bench/bench.rb
|
135
|
-
- bin/console
|
136
|
-
- doclib/msgpack.rb
|
137
|
-
- doclib/msgpack/buffer.rb
|
138
|
-
- doclib/msgpack/core_ext.rb
|
139
|
-
- doclib/msgpack/error.rb
|
140
|
-
- doclib/msgpack/extension_value.rb
|
141
|
-
- doclib/msgpack/factory.rb
|
142
|
-
- doclib/msgpack/packer.rb
|
143
|
-
- doclib/msgpack/time.rb
|
144
|
-
- doclib/msgpack/timestamp.rb
|
145
|
-
- doclib/msgpack/unpacker.rb
|
146
142
|
- ext/java/org/msgpack/jruby/Buffer.java
|
147
143
|
- ext/java/org/msgpack/jruby/Decoder.java
|
148
144
|
- ext/java/org/msgpack/jruby/Encoder.java
|
@@ -183,6 +179,7 @@ files:
|
|
183
179
|
- ext/msgpack/unpacker_ext_registry.h
|
184
180
|
- lib/msgpack.rb
|
185
181
|
- lib/msgpack/bigint.rb
|
182
|
+
- lib/msgpack/buffer.rb
|
186
183
|
- lib/msgpack/core_ext.rb
|
187
184
|
- lib/msgpack/factory.rb
|
188
185
|
- lib/msgpack/packer.rb
|
@@ -192,32 +189,6 @@ files:
|
|
192
189
|
- lib/msgpack/unpacker.rb
|
193
190
|
- lib/msgpack/version.rb
|
194
191
|
- msgpack.gemspec
|
195
|
-
- msgpack.org.md
|
196
|
-
- spec/bigint_spec.rb
|
197
|
-
- spec/cases.json
|
198
|
-
- spec/cases.msg
|
199
|
-
- spec/cases_compact.msg
|
200
|
-
- spec/cases_spec.rb
|
201
|
-
- spec/cruby/buffer_io_spec.rb
|
202
|
-
- spec/cruby/buffer_packer.rb
|
203
|
-
- spec/cruby/buffer_spec.rb
|
204
|
-
- spec/cruby/buffer_unpacker.rb
|
205
|
-
- spec/cruby/unpacker_spec.rb
|
206
|
-
- spec/ext_value_spec.rb
|
207
|
-
- spec/exttypes.rb
|
208
|
-
- spec/factory_spec.rb
|
209
|
-
- spec/format_spec.rb
|
210
|
-
- spec/jruby/benchmarks/shootout_bm.rb
|
211
|
-
- spec/jruby/benchmarks/symbolize_keys_bm.rb
|
212
|
-
- spec/jruby/unpacker_spec.rb
|
213
|
-
- spec/msgpack_spec.rb
|
214
|
-
- spec/pack_spec.rb
|
215
|
-
- spec/packer_spec.rb
|
216
|
-
- spec/random_compat.rb
|
217
|
-
- spec/spec_helper.rb
|
218
|
-
- spec/timestamp_spec.rb
|
219
|
-
- spec/unpack_spec.rb
|
220
|
-
- spec/unpacker_spec.rb
|
221
192
|
homepage: http://msgpack.org/
|
222
193
|
licenses:
|
223
194
|
- Apache 2.0
|
@@ -230,14 +201,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
230
201
|
requirements:
|
231
202
|
- - ">="
|
232
203
|
- !ruby/object:Gem::Version
|
233
|
-
version: '2.
|
204
|
+
version: '2.5'
|
234
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
235
206
|
requirements:
|
236
207
|
- - ">="
|
237
208
|
- !ruby/object:Gem::Version
|
238
209
|
version: '0'
|
239
210
|
requirements: []
|
240
|
-
rubygems_version: 3.
|
211
|
+
rubygems_version: 3.4.6
|
241
212
|
signing_key:
|
242
213
|
specification_version: 4
|
243
214
|
summary: MessagePack, a binary-based efficient data interchange format.
|
data/.github/workflows/ci.yaml
DELETED
@@ -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
|
-
other:
|
29
|
-
strategy:
|
30
|
-
fail-fast: false
|
31
|
-
matrix:
|
32
|
-
os: [ubuntu]
|
33
|
-
ruby: ['jruby-9.2.19.0', 'jruby-9.3.3.0', 'truffleruby']
|
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 spec
|
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']
|
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 spec || 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
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/bench.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
# % bundle install
|
2
|
-
# % bundle exec ruby bench/bench.rb
|
3
|
-
|
4
|
-
require 'msgpack'
|
5
|
-
|
6
|
-
require 'benchmark/ips'
|
7
|
-
|
8
|
-
object_plain = {
|
9
|
-
'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)"'
|
10
|
-
}
|
11
|
-
|
12
|
-
data_plain = MessagePack.pack(object_plain)
|
13
|
-
|
14
|
-
object_structured = {
|
15
|
-
'remote_host' => '127.0.0.1',
|
16
|
-
'remote_user' => '-',
|
17
|
-
'date' => '10/Oct/2000:13:55:36 -0700',
|
18
|
-
'request' => 'GET /apache_pb.gif HTTP/1.0',
|
19
|
-
'method' => 'GET',
|
20
|
-
'path' => '/apache_pb.gif',
|
21
|
-
'protocol' => 'HTTP/1.0',
|
22
|
-
'status' => 200,
|
23
|
-
'bytes' => 2326,
|
24
|
-
'referer' => 'http://www.example.com/start.html',
|
25
|
-
'agent' => 'Mozilla/4.08 [en] (Win98; I ;Nav)',
|
26
|
-
}
|
27
|
-
|
28
|
-
data_structured = MessagePack.pack(object_structured)
|
29
|
-
|
30
|
-
class Extended
|
31
|
-
def to_msgpack_ext
|
32
|
-
MessagePack.pack({})
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.from_msgpack_ext(data)
|
36
|
-
MessagePack.unpack(data)
|
37
|
-
Extended.new
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
object_extended = {
|
42
|
-
'extended' => Extended.new
|
43
|
-
}
|
44
|
-
|
45
|
-
extended_packer = MessagePack::Packer.new
|
46
|
-
extended_packer.register_type(0x00, Extended, :to_msgpack_ext)
|
47
|
-
data_extended = extended_packer.pack(object_extended).to_s
|
48
|
-
|
49
|
-
Benchmark.ips do |x|
|
50
|
-
x.report('pack-plain') do
|
51
|
-
MessagePack.pack(object_plain)
|
52
|
-
end
|
53
|
-
|
54
|
-
x.report('pack-structured') do
|
55
|
-
MessagePack.pack(object_structured)
|
56
|
-
end
|
57
|
-
|
58
|
-
x.report('pack-extended') do
|
59
|
-
packer = MessagePack::Packer.new
|
60
|
-
packer.register_type(0x00, Extended, :to_msgpack_ext)
|
61
|
-
packer.pack(object_extended).to_s
|
62
|
-
end
|
63
|
-
|
64
|
-
x.report('unpack-plain') do
|
65
|
-
MessagePack.unpack(data_plain)
|
66
|
-
end
|
67
|
-
|
68
|
-
x.report('unpack-structured') do
|
69
|
-
MessagePack.unpack(data_structured)
|
70
|
-
end
|
71
|
-
|
72
|
-
x.report('unpack-extended') do
|
73
|
-
unpacker = MessagePack::Unpacker.new
|
74
|
-
unpacker.register_type(0x00, Extended, :from_msgpack_ext)
|
75
|
-
unpacker.feed data_extended
|
76
|
-
unpacker.read
|
77
|
-
end
|
78
|
-
end
|