msgpack 1.2.9 → 1.2.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d16569e0d62e52e204691679006fdc2cdd8f99c9cf78239e242108557590b312
4
- data.tar.gz: 38eab17eeec848dc167565c7899f6686f9729c753f0c6d75b83928342ba08847
3
+ metadata.gz: d969c236941c85e4262f6584ce00a47ff4cdbaeb3d6e7eb6b557ffa02fb4e251
4
+ data.tar.gz: 888a6a2392eb3f9a4cc0a2856b47e6b1f969b6dd94ff1d3904d402a4ed376a05
5
5
  SHA512:
6
- metadata.gz: 06ffdcbcc4ddec5a1f0578b5cf8d1c517e7ba2604e37b697f7640f0c4abfbe0ce5ec610d80762c9c98df5ffb307dab33eedb5de7bbcd4a2f22d44447f305dbbd
7
- data.tar.gz: 3dc59dccebfb2777fdc3a1e5eb97a7a89f3d77c188d0fb9907acc433a5d21a8686c86be0275a46dd52c9ea369e0022022d50bca6fd0742f20e15114c12fdf2f7
6
+ metadata.gz: 5878a395788cab9c9fc3eec25d5390bcf10c87cf60b0785ce5f25a2a74b868f50861367b8884af11f3003a416a4e8eb420d32629955c36366da3e3e455e0a9d8
7
+ data.tar.gz: c6e029cd6ef240337bdf5918e996ddf8ce97d2f903f1c915adf5a5b9a8973bfe5cbbc225330a83bd29cd928107a86d8d70d9094417105a8aa574a3e02f546b00
@@ -23,9 +23,9 @@ matrix:
23
23
  os: linux
24
24
  - rvm: 2.5.3
25
25
  os: linux
26
- - rvm: 2.6.0
26
+ - rvm: 2.6.1
27
27
  os: linux
28
- - rvm: 2.6.0
28
+ - rvm: 2.6.1
29
29
  os: osx
30
30
  - rvm: ruby-head
31
31
  os: linux
@@ -36,6 +36,8 @@ matrix:
36
36
  - rvm: jruby-19mode
37
37
  os: linux
38
38
  allow_failures:
39
+ - rvm: 2.6.1
40
+ os: osx
39
41
  - rvm: ruby-head
40
42
  - rvm: jruby-head
41
43
  - rvm: jruby-19mode
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ 2019-04-19 version 1.2.10:
2
+
3
+ * Optimze MessagePack.unpack not to copy source string
4
+
1
5
  2019-03-13 version 1.2.9:
2
6
 
3
7
  * Hotfix release only for JRuby: 1.2.8-java was built incorrectly
@@ -170,7 +170,7 @@ public class Unpacker extends RubyObject {
170
170
  return data == null ? ctx.getRuntime().getFalse() : ctx.getRuntime().getTrue();
171
171
  }
172
172
 
173
- @JRubyMethod(required = 1)
173
+ @JRubyMethod(required = 1, name = "feed", alias = { "feed_reference" })
174
174
  public IRubyObject feed(ThreadContext ctx, IRubyObject data) {
175
175
  ByteList byteList = data.asString().getByteList();
176
176
  if (decoder == null) {
@@ -262,6 +262,20 @@ static inline size_t msgpack_buffer_append_string(msgpack_buffer_t* b, VALUE str
262
262
  return length;
263
263
  }
264
264
 
265
+ static inline size_t msgpack_buffer_append_string_reference(msgpack_buffer_t* b, VALUE string)
266
+ {
267
+ size_t length = RSTRING_LEN(string);
268
+
269
+ if(length > MSGPACK_BUFFER_STRING_WRITE_REFERENCE_MINIMUM) {
270
+ _msgpack_buffer_append_long_string(b, string);
271
+
272
+ } else {
273
+ msgpack_buffer_append(b, RSTRING_PTR(string), length);
274
+ }
275
+
276
+ return length;
277
+ }
278
+
265
279
 
266
280
  /*
267
281
  * IO functions
@@ -256,6 +256,17 @@ static VALUE Unpacker_feed(VALUE self, VALUE data)
256
256
  return self;
257
257
  }
258
258
 
259
+ static VALUE Unpacker_feed_reference(VALUE self, VALUE data)
260
+ {
261
+ UNPACKER(self, uk);
262
+
263
+ StringValue(data);
264
+
265
+ msgpack_buffer_append_string_reference(UNPACKER_BUFFER_(uk), data);
266
+
267
+ return self;
268
+ }
269
+
259
270
  static VALUE Unpacker_each_impl(VALUE self)
260
271
  {
261
272
  UNPACKER(self, uk);
@@ -312,8 +323,7 @@ static VALUE Unpacker_feed_each(VALUE self, VALUE data)
312
323
  }
313
324
  #endif
314
325
 
315
- // TODO optimize
316
- Unpacker_feed(self, data);
326
+ Unpacker_feed_reference(self, data);
317
327
  return Unpacker_each(self);
318
328
  }
319
329
 
@@ -386,9 +396,6 @@ static VALUE Unpacker_full_unpack(VALUE self)
386
396
  {
387
397
  UNPACKER(self, uk);
388
398
 
389
- /* prefer reference than copying; see MessagePack_Unpacker_module_init */
390
- msgpack_buffer_set_write_reference_threshold(UNPACKER_BUFFER_(uk), 0);
391
-
392
399
  int r = msgpack_unpacker_read(uk, 0);
393
400
  if(r < 0) {
394
401
  raise_unpacker_error(r);
@@ -444,6 +451,7 @@ void MessagePack_Unpacker_module_init(VALUE mMessagePack)
444
451
  rb_define_method(cMessagePack_Unpacker, "read_map_header", Unpacker_read_map_header, 0);
445
452
  //rb_define_method(cMessagePack_Unpacker, "peek_next_type", Unpacker_peek_next_type, 0); // TODO
446
453
  rb_define_method(cMessagePack_Unpacker, "feed", Unpacker_feed, 1);
454
+ rb_define_method(cMessagePack_Unpacker, "feed_reference", Unpacker_feed_reference, 1);
447
455
  rb_define_method(cMessagePack_Unpacker, "each", Unpacker_each, 0);
448
456
  rb_define_method(cMessagePack_Unpacker, "feed_each", Unpacker_feed_each, 1);
449
457
  rb_define_method(cMessagePack_Unpacker, "reset", Unpacker_reset, 0);
@@ -27,7 +27,7 @@ module MessagePack
27
27
 
28
28
  if src.is_a? String
29
29
  unpacker = DefaultFactory.unpacker param || DEFAULT_EMPTY_PARAMS
30
- unpacker.feed src
30
+ unpacker.feed_reference src
31
31
  else
32
32
  unpacker = DefaultFactory.unpacker src, param || DEFAULT_EMPTY_PARAMS
33
33
  end
@@ -1,5 +1,5 @@
1
1
  module MessagePack
2
- VERSION = "1.2.9"
2
+ VERSION = "1.2.10"
3
3
 
4
4
  # NOTE for msgpack-ruby maintainer:
5
5
  # Check these things to release new binaryes for new Ruby versions (especially for Windows):
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.2.9
4
+ version: 1.2.10
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: 2019-03-13 00:00:00.000000000 Z
13
+ date: 2019-04-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
238
  - !ruby/object:Gem::Version
239
239
  version: '0'
240
240
  requirements: []
241
- rubygems_version: 3.0.1
241
+ rubygems_version: 3.0.3
242
242
  signing_key:
243
243
  specification_version: 4
244
244
  summary: MessagePack, a binary-based efficient data interchange format.