Skip to content

Commit afd543a

Browse files
committed
Optimized zero-sized collection decoding
1 parent 499ecd6 commit afd543a

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
factory
22
createArray: size
3+
size = 0 ifTrue: [ ^#() ].
34
^Array new: size

repository/MessagePack-Core.package/MpDecoder.class/instance/readFixRaw..st

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ readFixRaw: firstByte
33
| size |
44
self typeMapper isBytesAsString ifTrue: [^self readFixString: firstByte].
55
size := (firstByte bitAnd: 2r11111).
6+
size = 0 ifTrue: [ ^ #[] ].
67
^self readStream next: size

repository/MessagePack-Core.package/MpDecoder.class/instance/readFixString..st

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ reading-string
22
readFixString: firstByte
33
| size |
44
size := (firstByte bitAnd: 2r11111).
5+
size = 0 ifTrue: [ ^ '' ].
56
^MpPortableUtil default stringFromBytes: (self readStream next: size)

repository/MessagePack-Core.package/MpDecoder.class/methodProperties.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"readObjectOf:" : "mu 5/8/2011 23:11",
2323
"readArraySized:" : "mu 4/30/2011 23:46",
2424
"readObject" : "mu 5/8/2011 23:12",
25-
"readFixRaw:" : "MasashiUmezawa 2/2/2013 01:10",
25+
"readFixRaw:" : "mu 11/9/2018 22:50",
2626
"readFixext4" : "mu 11/5/2013 00:02",
2727
"readInt16" : "mu 5/1/2011 16:06",
2828
"readInt32" : "mu 5/1/2011 16:06",
@@ -65,10 +65,10 @@
6565
"readStr8" : "mu 8/26/2013 00:04",
6666
"readTimestamp96:" : "MasashiUmezawa 8/11/2017 17:21",
6767
"readNegativeFixNum:" : "mu 7/15/2011 23:47",
68-
"createArray:" : "mu 4/30/2011 23:46",
68+
"createArray:" : "mu 11/9/2018 23:01",
6969
"readBin16" : "mu 8/12/2013 00:43",
7070
"readBin32" : "mu 8/12/2013 00:43",
71-
"readFixString:" : "MasashiUmezawa 11/12/2016 23:18",
71+
"readFixString:" : "mu 11/9/2018 22:58",
7272
"readStream" : "mu 4/29/2011 23:40",
7373
"decode:setting:" : "MasashiUmezawa 2/1/2013 23:13",
7474
"createDictionary:" : "mu 4/29/2011 23:40",

repository/MessagePack-Core.package/monticello.meta/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(name 'MessagePack-Core-MasashiUmezawa.41' message 'Changed writeString: to use MpPortableUtil' id 'c01e4ecf-9e17-0d00-86b6-71f00cd037ad' date '11 October 2017' time '12:32:27.514078 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.40' message 'Fixed readTimestamp32:' id '43ec3ea1-fd12-0d00-961d-9dd50ade5bf7' date '13 August 2017' time '2:33:58.520426 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.39' message 'Added Timestamp decoding' id '561706d2-d712-0d00-ab4d-9685014acda9' date '11 August 2017' time '5:27:28.122221 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.38' message 'Added Timestamp encoding' id '5c465aa7-d512-0d00-99f6-811d006f5111' date '11 August 2017' time '2:52:22.284571 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.37' message 'Optimized MpEncoder''s type mapper creation ' id '60238847-3a2c-4a3d-86c2-9378dc5b091a' date '4 February 2017' time '10:18:06.75242 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.36' message 'MpDecoder now assumes strings are utf8 encoded' id 'eed3c7c0-24a6-cf46-9bba-1dd6b7bf4e83' date '12 November 2016' time '11:26:28.400191 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.35' message 'Added symbolAsString setting' id '42ae866c-30b7-1a45-a197-a005b7e5fa90' date '4 June 2016' time '2:22:42.063615 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.34' message 'MpSettings>>formatVersion -> 2013 is now default' id '51579c03-5587-47f1-9ebf-8a5ef7470230' date '21 June 2015' time '4:34:16.532914 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.33' message 'Fixed a mapping bug in MpDecodeTypeMapper>>bytesAsString' id 'd6135ce8-d710-444d-b3b0-2a6c24168765' date '23 May 2015' time '11:36:39.85456 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.32' message 'Renamed MpConstants typecode methods for compatibility with GemStone.https://github.com/msgpack/msgpack-smalltalk/issues/4' id '7672363c-2b3d-422c-a18d-63de7ceb21ba' date '18 May 2015' time '10:54:43.647181 am' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-mu.31' message '- Ext and Fixext encoding/decoding are now working' id '958b6113-8b9b-214c-a28e-38c991a8b70b' date '8 December 2013' time '3:47:05.753 pm' author 'mu' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
1+
(name 'MessagePack-Core-mu.42' message 'Optimized zero-sized collection decoding' id '150b48a4-9d36-0d00-9f25-f5ad0931b5fd' date '9 November 2018' time '11:09:51.189123 pm' author 'mu' ancestors ((name 'MessagePack-Core-MasashiUmezawa.41' message 'Changed writeString: to use MpPortableUtil' id 'c01e4ecf-9e17-0d00-86b6-71f00cd037ad' date '11 October 2017' time '12:32:27.514078 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.40' message 'Fixed readTimestamp32:' id '43ec3ea1-fd12-0d00-961d-9dd50ade5bf7' date '13 August 2017' time '2:33:58.520426 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.39' message 'Added Timestamp decoding' id '561706d2-d712-0d00-ab4d-9685014acda9' date '11 August 2017' time '5:27:28.122221 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.38' message 'Added Timestamp encoding' id '5c465aa7-d512-0d00-99f6-811d006f5111' date '11 August 2017' time '2:52:22.284571 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.37' message 'Optimized MpEncoder''s type mapper creation ' id '60238847-3a2c-4a3d-86c2-9378dc5b091a' date '4 February 2017' time '10:18:06.75242 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.36' message 'MpDecoder now assumes strings are utf8 encoded' id 'eed3c7c0-24a6-cf46-9bba-1dd6b7bf4e83' date '12 November 2016' time '11:26:28.400191 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.35' message 'Added symbolAsString setting' id '42ae866c-30b7-1a45-a197-a005b7e5fa90' date '4 June 2016' time '2:22:42.063615 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.34' message 'MpSettings>>formatVersion -> 2013 is now default' id '51579c03-5587-47f1-9ebf-8a5ef7470230' date '21 June 2015' time '4:34:16.532914 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.33' message 'Fixed a mapping bug in MpDecodeTypeMapper>>bytesAsString' id 'd6135ce8-d710-444d-b3b0-2a6c24168765' date '23 May 2015' time '11:36:39.85456 pm' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-MasashiUmezawa.32' message 'Renamed MpConstants typecode methods for compatibility with GemStone.https://github.com/msgpack/msgpack-smalltalk/issues/4' id '7672363c-2b3d-422c-a18d-63de7ceb21ba' date '18 May 2015' time '10:54:43.647181 am' author 'MasashiUmezawa' ancestors ((name 'MessagePack-Core-mu.31' message '- Ext and Fixext encoding/decoding are now working' id '958b6113-8b9b-214c-a28e-38c991a8b70b' date '8 December 2013' time '3:47:05.753 pm' author 'mu' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())

0 commit comments

Comments
 (0)