Skip to content

Commit

Permalink
msgpack: use unsafe bytes to string convertion
Browse files Browse the repository at this point in the history
name                                  old time/op    new time/op    delta
Encode/Bool/True-20                     57.7ns ± 0%    62.4ns ± 1%     ~     (p=0.100 n=3+3)
Encode/Uint8-20                         58.5ns ± 0%    61.2ns ± 2%     ~     (p=0.100 n=3+3)
Encode/Int16-20                         58.8ns ± 1%    61.4ns ± 1%     ~     (p=0.100 n=3+3)
Encode/Array-20                          107ns ± 1%     115ns ± 1%     ~     (p=0.100 n=3+3)
Encode/Map-20                            710ns ± 1%     737ns ± 0%     ~     (p=0.100 n=3+3)
Encode/Bool/False-20                    57.4ns ± 0%    62.9ns ± 1%     ~     (p=0.100 n=3+3)
Encode/Uint16-20                        58.7ns ± 1%    61.6ns ± 0%     ~     (p=0.100 n=3+3)
Encode/Uint64-20                        60.4ns ± 0%    63.1ns ± 1%     ~     (p=0.100 n=3+3)
Encode/Int64-20                         58.6ns ± 1%    62.0ns ± 1%     ~     (p=0.100 n=3+3)
Encode/Float32-20                       58.4ns ± 1%    59.6ns ± 1%     ~     (p=0.100 n=3+3)
Encode/Uint32-20                        59.6ns ± 1%    63.0ns ± 2%     ~     (p=0.100 n=3+3)
Encode/Int8-20                          56.9ns ± 0%    59.7ns ± 1%     ~     (p=0.100 n=3+3)
Encode/Int32-20                         59.5ns ± 0%    63.1ns ± 3%     ~     (p=0.100 n=3+3)
Encode/Float64-20                       58.4ns ± 1%    59.4ns ± 0%     ~     (p=0.100 n=3+3)
Encode/String-20                        68.6ns ± 0%    70.6ns ± 1%     ~     (p=0.100 n=3+3)
Encode/Parallel/Bool/True-20            91.3ns ± 4%    95.7ns ± 9%     ~     (p=0.400 n=3+3)
Encode/Parallel/Uint8-20                94.7ns ±12%   100.7ns ± 1%     ~     (p=0.700 n=3+3)
Encode/Parallel/Int16-20                95.1ns ±10%    95.3ns ± 1%     ~     (p=0.700 n=3+3)
Encode/Parallel/Array-20                93.8ns ± 4%    98.8ns ± 2%     ~     (p=0.200 n=3+3)
Encode/Parallel/Map-20                   195ns ± 4%     202ns ± 2%     ~     (p=0.200 n=3+3)
Encode/Parallel/Bool/False-20           95.8ns ± 8%    88.7ns ± 1%     ~     (p=0.500 n=3+3)
Encode/Parallel/Uint16-20                102ns ± 7%      91ns ± 2%     ~     (p=0.100 n=3+3)
Encode/Parallel/Uint64-20               95.9ns ± 3%    92.5ns ± 5%     ~     (p=0.400 n=3+3)
Encode/Parallel/Int64-20                98.7ns ± 8%    94.1ns ± 7%     ~     (p=0.700 n=3+3)
Encode/Parallel/Float32-20              92.8ns ± 4%    92.6ns ± 4%     ~     (p=1.000 n=3+3)
Encode/Parallel/Uint32-20               96.5ns ± 6%    90.9ns ± 1%     ~     (p=0.400 n=3+3)
Encode/Parallel/Int8-20                 97.3ns ± 7%    97.3ns ± 4%     ~     (p=1.000 n=3+3)
Encode/Parallel/Int32-20                98.3ns ±10%    95.6ns ± 3%     ~     (p=0.700 n=3+3)
Encode/Parallel/Float64-20               101ns ± 5%      98ns ± 5%     ~     (p=1.000 n=3+3)
Encode/Parallel/String-20                100ns ± 5%      96ns ± 7%     ~     (p=1.000 n=3+3)
PackBool/False-20                       4.39ns ± 1%    4.70ns ± 2%     ~     (p=0.100 n=3+3)
PackBool/True-20                        4.37ns ± 0%    4.63ns ± 0%     ~     (p=0.100 n=3+3)
PackUint8-20                            6.77ns ± 1%    7.18ns ± 0%     ~     (p=0.100 n=3+3)
PackUint16-20                           6.95ns ± 1%    7.34ns ± 1%     ~     (p=0.100 n=3+3)
PackUint32-20                           7.23ns ± 1%    7.79ns ± 2%     ~     (p=0.100 n=3+3)
PackUint64-20                           6.81ns ± 1%    7.17ns ± 1%     ~     (p=0.100 n=3+3)
PackInt8-20                             4.36ns ± 1%    4.61ns ± 0%     ~     (p=0.100 n=3+3)
PackInt16-20                            6.93ns ± 1%    7.33ns ± 1%     ~     (p=0.100 n=3+3)
PackInt32-20                            7.32ns ± 1%    7.72ns ± 1%     ~     (p=0.100 n=3+3)
PackInt64-20                            6.83ns ± 1%    7.37ns ± 1%     ~     (p=0.100 n=3+3)
PackFloat32-20                          4.72ns ± 1%    5.03ns ± 1%     ~     (p=0.100 n=3+3)
PackFloat64-20                          4.75ns ± 0%    5.03ns ± 1%     ~     (p=0.100 n=3+3)
PackString/MaxUint8-20                  13.7ns ± 2%    14.5ns ± 2%     ~     (p=0.100 n=3+3)
PackString/MaxUint8+1-20                13.7ns ± 1%    14.5ns ± 1%     ~     (p=0.100 n=3+3)
PackString/MaxUint16-20                 13.8ns ± 1%    14.8ns ± 3%     ~     (p=0.100 n=3+3)
PackStringBytes/MaxUint8-20             11.6ns ± 2%    12.3ns ± 2%     ~     (p=0.100 n=3+3)
PackStringBytes/MaxUint8+1-20           11.7ns ± 1%    12.7ns ± 1%     ~     (p=0.100 n=3+3)
PackStringBytes/MaxUint16-20            11.8ns ± 1%    12.9ns ± 1%     ~     (p=0.100 n=3+3)
PackBinary/MaxUint8-20                  10.0ns ± 1%    10.8ns ± 1%     ~     (p=0.100 n=3+3)
PackBinary/MaxUint8+1-20                10.0ns ± 1%    10.9ns ± 0%     ~     (p=0.100 n=3+3)
PackBinary/MaxUint16-20                 9.94ns ± 1%   10.66ns ± 3%     ~     (p=0.100 n=3+3)
PackArrayLen/MaxUint8-20                7.35ns ± 1%    7.74ns ± 0%     ~     (p=0.100 n=3+3)
PackArrayLen/MaxUint16-20               7.34ns ± 1%    7.73ns ± 1%     ~     (p=0.100 n=3+3)
PackArrayLen/MaxUint32-20               7.67ns ± 1%    8.05ns ± 1%     ~     (p=0.100 n=3+3)
PackMapLen/MaxUint8-20                  7.34ns ± 1%    7.83ns ± 2%     ~     (p=0.100 n=3+3)
PackMapLen/MaxUint16-20                 7.34ns ± 0%    7.82ns ± 3%     ~     (p=0.100 n=3+3)
PackMapLen/MaxUint32-20                 7.68ns ± 1%    8.02ns ± 0%     ~     (p=0.100 n=3+3)
Decode/Bool/False-20                     120ns ± 1%     125ns ± 0%     ~     (p=0.100 n=3+3)
Decode/Bool/True-20                      121ns ± 1%     124ns ± 2%     ~     (p=0.200 n=3+3)
Decode/Uint8-20                          135ns ± 1%     139ns ± 1%     ~     (p=0.100 n=3+3)
Decode/Uint16-20                         142ns ± 1%     146ns ± 0%     ~     (p=0.100 n=3+3)
Decode/Uint32-20                         143ns ± 1%     146ns ± 0%     ~     (p=0.100 n=3+3)
Decode/Uint64-20                         152ns ± 1%     154ns ± 1%     ~     (p=0.100 n=3+3)
Decode/FixInt8-20                        128ns ± 1%     132ns ± 1%     ~     (p=0.100 n=3+3)
Decode/Int8-20                           139ns ± 0%     144ns ± 3%     ~     (p=0.100 n=3+3)
Decode/Int16-20                          145ns ± 1%     150ns ± 1%     ~     (p=0.100 n=3+3)
Decode/Int32-20                          146ns ± 0%     151ns ± 1%     ~     (p=0.100 n=3+3)
Decode/Int64-20                          151ns ± 1%     157ns ± 2%     ~     (p=0.100 n=3+3)
Decode/Float32-20                        146ns ± 0%     149ns ± 1%     ~     (p=0.100 n=3+3)
Decode/Float64-20                        151ns ± 1%     156ns ± 1%     ~     (p=0.100 n=3+3)
Decode/String-20                        26.4µs ± 1%    14.3µs ± 0%     ~     (p=0.100 n=3+3)
Decode/StringBytes-20                   15.5µs ± 0%    15.6µs ± 0%     ~     (p=0.200 n=3+3)
Decode/Binary-20                        15.4µs ± 0%    15.5µs ± 0%     ~     (p=0.200 n=3+3)
Decode/Array/String-20                  27.3µs ± 0%    15.2µs ± 1%     ~     (p=0.100 n=3+3)
Decode/Array/Uint64-20                   760ns ± 1%     785ns ± 1%     ~     (p=0.100 n=3+3)
Decode/Map/String-20                    28.4µs ± 1%     2.0µs ± 1%     ~     (p=0.100 n=3+3)
Decode/Map/Interface-20                 3.00µs ± 1%    3.02µs ± 2%     ~     (p=0.700 n=3+3)
DecoderBool/Bool/True-20                4.20ns ± 0%    4.51ns ± 2%     ~     (p=0.100 n=3+3)
DecoderBool/Bool/False-20               4.23ns ± 2%    4.49ns ± 1%     ~     (p=0.100 n=3+3)
DecoderBool/Int/True-20                 4.41ns ± 1%    4.67ns ± 1%     ~     (p=0.100 n=3+3)
DecoderBool/Int/False-20                4.42ns ± 0%    4.62ns ± 1%     ~     (p=0.100 n=3+3)
DecoderBool/Uint/True-20                5.18ns ± 1%    4.76ns ± 1%     ~     (p=0.100 n=3+3)
DecoderBool/Uint/False-20               5.21ns ± 1%    4.72ns ± 0%     ~     (p=0.100 n=3+3)
DecoderInt/Int-20                       5.81ns ± 1%    6.27ns ± 2%     ~     (p=0.100 n=3+3)
DecoderInt/Uint-20                      6.21ns ± 1%    6.50ns ± 0%     ~     (p=0.100 n=3+3)
DecoderInt/Float-20                     18.5ns ± 0%    19.3ns ± 1%     ~     (p=0.100 n=3+3)
DecoderUint/Int-20                      5.74ns ± 2%    6.11ns ± 2%     ~     (p=0.100 n=3+3)
DecoderUint/Uint-20                     5.66ns ± 1%    6.00ns ± 1%     ~     (p=0.100 n=3+3)
DecoderUint/Float-20                    20.2ns ± 1%    20.9ns ± 1%     ~     (p=0.100 n=3+3)
DecoderFloat/Int-20                     4.42ns ± 0%    4.76ns ± 2%     ~     (p=0.100 n=3+3)
DecoderFloat/Uint-20                    4.62ns ± 1%    4.89ns ± 1%     ~     (p=0.100 n=3+3)
DecoderFloat/Float-20                   5.01ns ± 1%    5.15ns ± 1%     ~     (p=0.100 n=3+3)
DecoderString/Binary-20                 6.37µs ± 0%    0.01µs ± 2%     ~     (p=0.100 n=3+3)
DecoderString/String-20                 6.39µs ± 1%    0.01µs ± 1%     ~     (p=0.100 n=3+3)
DecoderByteSlice/Binary-20              8.30ns ± 2%    8.65ns ± 2%     ~     (p=0.200 n=3+3)
DecoderByteSlice/String-20              8.16ns ± 1%    8.69ns ± 1%     ~     (p=0.100 n=3+3)
DecoderInterface/Bool/True-20           11.4ns ± 1%    11.5ns ± 1%     ~     (p=0.400 n=3+3)
DecoderInterface/Bool/False-20          11.0ns ± 2%    11.6ns ± 1%     ~     (p=0.100 n=3+3)
DecoderInterface/Int-20                 10.7ns ± 0%    11.4ns ± 1%     ~     (p=0.100 n=3+3)
DecoderInterface/Uint-20                10.8ns ± 2%    11.4ns ± 1%     ~     (p=0.100 n=3+3)
DecoderInterface/Float-20               10.7ns ± 1%    11.5ns ± 2%     ~     (p=0.100 n=3+3)
DecoderInterface/String-20              10.7ns ± 1%    11.4ns ± 1%     ~     (p=0.100 n=3+3)
DecoderInterface/ArrayLen-20            64.0ns ± 1%    68.1ns ± 3%     ~     (p=0.100 n=3+3)
DecoderInterface/MapLen/String-20       62.2ns ± 0%    67.7ns ± 0%     ~     (p=0.100 n=3+3)
DecoderInterface/MapLen/Interface-20    62.4ns ± 1%    66.8ns ± 0%     ~     (p=0.100 n=3+3)
DecoderInterface/Nil-20                 18.1ns ± 2%    19.4ns ± 2%     ~     (p=0.100 n=3+3)
UnpackUint8-20                          22.6ns ± 4%    24.1ns ± 3%     ~     (p=0.100 n=3+3)
UnpackUint16-20                         26.3ns ± 3%    28.8ns ± 1%     ~     (p=0.100 n=3+3)
UnpackUint32-20                         26.7ns ± 3%    29.3ns ± 4%     ~     (p=0.100 n=3+3)
UnpackUint64-20                         27.7ns ± 1%    29.2ns ± 3%     ~     (p=0.100 n=3+3)
UnpackFixInt8-20                        14.0ns ± 5%    18.6ns ± 1%     ~     (p=0.100 n=3+3)
UnpackInt8-20                           22.0ns ± 1%    24.7ns ± 1%     ~     (p=0.100 n=3+3)
UnpackInt16-20                          28.3ns ± 3%    30.0ns ± 3%     ~     (p=0.100 n=3+3)
UnpackInt32-20                          28.4ns ± 3%    30.1ns ± 3%     ~     (p=0.100 n=3+3)
UnpackInt64-20                          26.4ns ± 0%    29.1ns ± 2%     ~     (p=0.100 n=3+3)
UnpackFloat32-20                        29.0ns ± 3%    30.5ns ± 3%     ~     (p=0.100 n=3+3)
UnpackFloat64-20                        27.5ns ± 3%    29.1ns ± 1%     ~     (p=0.100 n=3+3)
UnpackString-20                         24.4µs ± 0%    13.4µs ± 1%     ~     (p=0.100 n=3+3)
UnpackArray/Uint-20                     15.8ns ± 3%    16.7ns ± 2%     ~     (p=0.100 n=3+3)
UnpackArray/Binary-20                   4.01µs ± 1%    4.00µs ± 2%     ~     (p=1.000 n=3+3)
UnpackMap-20                            20.7ns ± 3%    21.9ns ± 3%     ~     (p=0.100 n=3+3)
_correctFilels/Named-20                 7.84µs ± 0%    8.13µs ± 1%     ~     (p=0.100 n=3+3)
_correctFilels/Empty-20                 7.84µs ± 0%    8.09µs ± 1%     ~     (p=0.100 n=3+3)
_correctFilels/OmitEmpty-20             8.96µs ± 1%    9.27µs ± 0%     ~     (p=0.100 n=3+3)
EncodeMpack/api-20                      68.3ns ± 2%    66.2ns ± 0%     ~     (p=0.100 n=3+3)
EncodeMpack/api_metadata-20             13.8µs ± 1%    15.1µs ± 3%     ~     (p=0.100 n=3+3)
EncodeMpack/api_metadata/Empty-20       38.7µs ± 1%    41.8µs ± 5%     ~     (p=0.100 n=3+3)
EncodeMpack/funcs_data-20               69.5ns ± 1%    67.9ns ± 1%     ~     (p=0.200 n=3+3)
DecodeMpack/api-20                      8.50µs ±12%    8.66µs ± 2%     ~     (p=0.700 n=3+3)
DecodeMpack/api_metadata-20             43.0µs ± 2%    22.3µs ± 3%     ~     (p=0.100 n=3+3)
DecodeMpack/api_metadata/Empty-20       46.4µs ± 2%    27.9µs ± 3%     ~     (p=0.100 n=3+3)
DecodeMpack/funcs_data-20               4.81µs ± 1%    5.22µs ± 1%     ~     (p=0.100 n=3+3)
[Geo mean]                              64.5ns         57.8ns       -10.39%

name                                  old alloc/op   new alloc/op   delta
Encode/Bool/True-20                      8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Uint8-20                          8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Int16-20                          8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Array-20                          8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Map-20                             296B ± 0%      296B ± 0%     ~     (all equal)
Encode/Bool/False-20                     8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Uint16-20                         8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Uint64-20                         8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Int64-20                          8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Float32-20                        8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Uint32-20                         8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Int8-20                           8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Int32-20                          8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Float64-20                        8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/String-20                         8.00B ± 0%     8.00B ± 0%     ~     (all equal)
Encode/Parallel/Bool/True-20              112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/Uint8-20                  112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/Int16-20                  112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/Array-20                  112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/Map-20                    400B ± 0%      400B ± 0%     ~     (all equal)
Encode/Parallel/Bool/False-20             112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/Uint16-20                 112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/Uint64-20                 112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/Int64-20                  112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/Float32-20                112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/Uint32-20                 112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/Int8-20                   112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/Int32-20                  112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/Float64-20                112B ± 0%      112B ± 0%     ~     (all equal)
Encode/Parallel/String-20                 112B ± 0%      112B ± 0%     ~     (all equal)
PackBool/False-20                        0.00B          0.00B          ~     (all equal)
PackBool/True-20                         0.00B          0.00B          ~     (all equal)
PackUint8-20                             0.00B          0.00B          ~     (all equal)
PackUint16-20                            0.00B          0.00B          ~     (all equal)
PackUint32-20                            0.00B          0.00B          ~     (all equal)
PackUint64-20                            0.00B          0.00B          ~     (all equal)
PackInt8-20                              0.00B          0.00B          ~     (all equal)
PackInt16-20                             0.00B          0.00B          ~     (all equal)
PackInt32-20                             0.00B          0.00B          ~     (all equal)
PackInt64-20                             0.00B          0.00B          ~     (all equal)
PackFloat32-20                           0.00B          0.00B          ~     (all equal)
PackFloat64-20                           0.00B          0.00B          ~     (all equal)
PackString/MaxUint8-20                   0.00B          0.00B          ~     (all equal)
PackString/MaxUint8+1-20                 0.00B          0.00B          ~     (all equal)
PackString/MaxUint16-20                  0.00B          0.00B          ~     (all equal)
PackStringBytes/MaxUint8-20              0.00B          0.00B          ~     (all equal)
PackStringBytes/MaxUint8+1-20            0.00B          0.00B          ~     (all equal)
PackStringBytes/MaxUint16-20             0.00B          0.00B          ~     (all equal)
PackBinary/MaxUint8-20                   0.00B          0.00B          ~     (all equal)
PackBinary/MaxUint8+1-20                 0.00B          0.00B          ~     (all equal)
PackBinary/MaxUint16-20                  0.00B          0.00B          ~     (all equal)
PackArrayLen/MaxUint8-20                 0.00B          0.00B          ~     (all equal)
PackArrayLen/MaxUint16-20                0.00B          0.00B          ~     (all equal)
PackArrayLen/MaxUint32-20                0.00B          0.00B          ~     (all equal)
PackMapLen/MaxUint8-20                   0.00B          0.00B          ~     (all equal)
PackMapLen/MaxUint16-20                  0.00B          0.00B          ~     (all equal)
PackMapLen/MaxUint32-20                  0.00B          0.00B          ~     (all equal)
Decode/Bool/False-20                     33.0B ± 0%     33.0B ± 0%     ~     (all equal)
Decode/Bool/True-20                      33.0B ± 0%     33.0B ± 0%     ~     (all equal)
Decode/Uint8-20                          33.0B ± 0%     33.0B ± 0%     ~     (all equal)
Decode/Uint16-20                         34.0B ± 0%     34.0B ± 0%     ~     (all equal)
Decode/Uint32-20                         36.0B ± 0%     36.0B ± 0%     ~     (all equal)
Decode/Uint64-20                         40.0B ± 0%     40.0B ± 0%     ~     (all equal)
Decode/FixInt8-20                        33.0B ± 0%     33.0B ± 0%     ~     (all equal)
Decode/Int8-20                           33.0B ± 0%     33.0B ± 0%     ~     (all equal)
Decode/Int16-20                          34.0B ± 0%     34.0B ± 0%     ~     (all equal)
Decode/Int32-20                          36.0B ± 0%     36.0B ± 0%     ~     (all equal)
Decode/Int64-20                          40.0B ± 0%     40.0B ± 0%     ~     (all equal)
Decode/Float32-20                        36.0B ± 0%     36.0B ± 0%     ~     (all equal)
Decode/Float64-20                        40.0B ± 0%     40.0B ± 0%     ~     (all equal)
Decode/String-20                         131kB ± 0%      66kB ± 0%     ~     (p=0.100 n=3+3)
Decode/StringBytes-20                   73.8kB ± 0%    73.8kB ± 0%     ~     (all equal)
Decode/Binary-20                        73.8kB ± 0%    73.8kB ± 0%     ~     (all equal)
Decode/Array/String-20                   132kB ± 0%      66kB ± 0%     ~     (p=0.100 n=3+3)
Decode/Array/Uint64-20                    200B ± 0%      200B ± 0%     ~     (all equal)
Decode/Map/String-20                     132kB ± 0%       1kB ± 0%     ~     (p=0.100 n=3+3)
Decode/Map/Interface-20                   944B ± 0%      912B ± 0%     ~     (p=0.100 n=3+3)
DecoderBool/Bool/True-20                 0.00B          0.00B          ~     (all equal)
DecoderBool/Bool/False-20                0.00B          0.00B          ~     (all equal)
DecoderBool/Int/True-20                  0.00B          0.00B          ~     (all equal)
DecoderBool/Int/False-20                 0.00B          0.00B          ~     (all equal)
DecoderBool/Uint/True-20                 0.00B          0.00B          ~     (all equal)
DecoderBool/Uint/False-20                0.00B          0.00B          ~     (all equal)
DecoderInt/Int-20                        0.00B          0.00B          ~     (all equal)
DecoderInt/Uint-20                       0.00B          0.00B          ~     (all equal)
DecoderInt/Float-20                      8.00B ± 0%     8.00B ± 0%     ~     (all equal)
DecoderUint/Int-20                       0.00B          0.00B          ~     (all equal)
DecoderUint/Uint-20                      0.00B          0.00B          ~     (all equal)
DecoderUint/Float-20                     8.00B ± 0%     8.00B ± 0%     ~     (all equal)
DecoderFloat/Int-20                      0.00B          0.00B          ~     (all equal)
DecoderFloat/Uint-20                     0.00B          0.00B          ~     (all equal)
DecoderFloat/Float-20                    0.00B          0.00B          ~     (all equal)
DecoderString/Binary-20                 32.8kB ± 0%     0.0kB          ~     (p=0.100 n=3+3)
DecoderString/String-20                 32.8kB ± 0%     0.0kB          ~     (p=0.100 n=3+3)
DecoderByteSlice/Binary-20               0.00B          0.00B          ~     (all equal)
DecoderByteSlice/String-20               0.00B          0.00B          ~     (all equal)
DecoderInterface/Bool/True-20            0.00B          0.00B          ~     (all equal)
DecoderInterface/Bool/False-20           0.00B          0.00B          ~     (all equal)
DecoderInterface/Int-20                  0.00B          0.00B          ~     (all equal)
DecoderInterface/Uint-20                 0.00B          0.00B          ~     (all equal)
DecoderInterface/Float-20                0.00B          0.00B          ~     (all equal)
DecoderInterface/String-20               0.00B          0.00B          ~     (all equal)
DecoderInterface/ArrayLen-20             8.00B ± 0%     8.00B ± 0%     ~     (all equal)
DecoderInterface/MapLen/String-20        8.00B ± 0%     8.00B ± 0%     ~     (all equal)
DecoderInterface/MapLen/Interface-20     8.00B ± 0%     8.00B ± 0%     ~     (all equal)
DecoderInterface/Nil-20                  0.00B          0.00B          ~     (all equal)
UnpackUint8-20                           0.00B          0.00B          ~     (all equal)
UnpackUint16-20                          0.00B          0.00B          ~     (all equal)
UnpackUint32-20                          0.00B          0.00B          ~     (all equal)
UnpackUint64-20                          0.00B          0.00B          ~     (all equal)
UnpackFixInt8-20                         0.00B          0.00B          ~     (all equal)
UnpackInt8-20                            0.00B          0.00B          ~     (all equal)
UnpackInt16-20                           0.00B          0.00B          ~     (all equal)
UnpackInt32-20                           0.00B          0.00B          ~     (all equal)
UnpackInt64-20                           0.00B          0.00B          ~     (all equal)
UnpackFloat32-20                         0.00B          0.00B          ~     (all equal)
UnpackFloat64-20                         0.00B          0.00B          ~     (all equal)
UnpackString-20                          131kB ± 0%      66kB ± 0%     ~     (p=0.100 n=3+3)
UnpackArray/Uint-20                      0.00B          0.00B          ~     (all equal)
UnpackArray/Binary-20                   21.8kB ± 0%    21.8kB ± 0%     ~     (all equal)
UnpackMap-20                             0.00B          0.00B          ~     (all equal)
_correctFilels/Named-20                 4.75kB ± 0%    4.75kB ± 0%     ~     (p=0.600 n=3+3)
_correctFilels/Empty-20                 4.75kB ± 0%    4.75kB ± 0%     ~     (p=1.000 n=3+3)
_correctFilels/OmitEmpty-20             5.10kB ± 0%    5.10kB ± 0%     ~     (p=1.000 n=3+3)
EncodeMpack/api-20                       8.00B ± 0%     8.00B ± 0%     ~     (all equal)
EncodeMpack/api_metadata-20              8.00B ± 0%     8.00B ± 0%     ~     (all equal)
EncodeMpack/api_metadata/Empty-20       37.1kB ± 0%    37.1kB ± 0%     ~     (p=1.000 n=3+3)
EncodeMpack/funcs_data-20                8.00B ± 0%     8.00B ± 0%     ~     (all equal)
DecodeMpack/api-20                       56.0B ± 4%     56.0B ± 2%     ~     (p=1.000 n=3+3)
DecodeMpack/api_metadata-20             14.2kB ± 0%     0.1kB ± 5%     ~     (p=0.100 n=3+3)
DecodeMpack/api_metadata/Empty-20       14.2kB ± 0%     0.1kB ± 2%     ~     (p=0.100 n=3+3)
DecodeMpack/funcs_data-20                35.0B ± 0%     35.0B ± 0%     ~     (all equal)
[Geo mean]                                138B            92B       -33.81%

name                                  old allocs/op  new allocs/op  delta
Encode/Bool/True-20                       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Uint8-20                           1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Int16-20                           1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Array-20                           1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Map-20                             11.0 ± 0%      11.0 ± 0%     ~     (all equal)
Encode/Bool/False-20                      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Uint16-20                          1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Uint64-20                          1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Int64-20                           1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Float32-20                         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Uint32-20                          1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Int8-20                            1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Int32-20                           1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Float64-20                         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/String-20                          1.00 ± 0%      1.00 ± 0%     ~     (all equal)
Encode/Parallel/Bool/True-20              3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/Uint8-20                  3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/Int16-20                  3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/Array-20                  3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/Map-20                    13.0 ± 0%      13.0 ± 0%     ~     (all equal)
Encode/Parallel/Bool/False-20             3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/Uint16-20                 3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/Uint64-20                 3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/Int64-20                  3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/Float32-20                3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/Uint32-20                 3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/Int8-20                   3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/Int32-20                  3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/Float64-20                3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Encode/Parallel/String-20                 3.00 ± 0%      3.00 ± 0%     ~     (all equal)
PackBool/False-20                         0.00           0.00          ~     (all equal)
PackBool/True-20                          0.00           0.00          ~     (all equal)
PackUint8-20                              0.00           0.00          ~     (all equal)
PackUint16-20                             0.00           0.00          ~     (all equal)
PackUint32-20                             0.00           0.00          ~     (all equal)
PackUint64-20                             0.00           0.00          ~     (all equal)
PackInt8-20                               0.00           0.00          ~     (all equal)
PackInt16-20                              0.00           0.00          ~     (all equal)
PackInt32-20                              0.00           0.00          ~     (all equal)
PackInt64-20                              0.00           0.00          ~     (all equal)
PackFloat32-20                            0.00           0.00          ~     (all equal)
PackFloat64-20                            0.00           0.00          ~     (all equal)
PackString/MaxUint8-20                    0.00           0.00          ~     (all equal)
PackString/MaxUint8+1-20                  0.00           0.00          ~     (all equal)
PackString/MaxUint16-20                   0.00           0.00          ~     (all equal)
PackStringBytes/MaxUint8-20               0.00           0.00          ~     (all equal)
PackStringBytes/MaxUint8+1-20             0.00           0.00          ~     (all equal)
PackStringBytes/MaxUint16-20              0.00           0.00          ~     (all equal)
PackBinary/MaxUint8-20                    0.00           0.00          ~     (all equal)
PackBinary/MaxUint8+1-20                  0.00           0.00          ~     (all equal)
PackBinary/MaxUint16-20                   0.00           0.00          ~     (all equal)
PackArrayLen/MaxUint8-20                  0.00           0.00          ~     (all equal)
PackArrayLen/MaxUint16-20                 0.00           0.00          ~     (all equal)
PackArrayLen/MaxUint32-20                 0.00           0.00          ~     (all equal)
PackMapLen/MaxUint8-20                    0.00           0.00          ~     (all equal)
PackMapLen/MaxUint16-20                   0.00           0.00          ~     (all equal)
PackMapLen/MaxUint32-20                   0.00           0.00          ~     (all equal)
Decode/Bool/False-20                      3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/Bool/True-20                       3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/Uint8-20                           3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/Uint16-20                          3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/Uint32-20                          3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/Uint64-20                          3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/FixInt8-20                         3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/Int8-20                            3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/Int16-20                           3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/Int32-20                           3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/Int64-20                           3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/Float32-20                         3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/Float64-20                         3.00 ± 0%      3.00 ± 0%     ~     (all equal)
Decode/String-20                          5.00 ± 0%      4.00 ± 0%     ~     (p=0.100 n=3+3)
Decode/StringBytes-20                     4.00 ± 0%      4.00 ± 0%     ~     (all equal)
Decode/Binary-20                          4.00 ± 0%      4.00 ± 0%     ~     (all equal)
Decode/Array/String-20                    17.0 ± 0%      14.0 ± 0%     ~     (p=0.100 n=3+3)
Decode/Array/Uint64-20                    13.0 ± 0%      13.0 ± 0%     ~     (all equal)
Decode/Map/String-20                      29.0 ± 0%      22.0 ± 0%     ~     (p=0.100 n=3+3)
Decode/Map/Interface-20                   34.0 ± 0%      30.0 ± 0%     ~     (p=0.100 n=3+3)
DecoderBool/Bool/True-20                  0.00           0.00          ~     (all equal)
DecoderBool/Bool/False-20                 0.00           0.00          ~     (all equal)
DecoderBool/Int/True-20                   0.00           0.00          ~     (all equal)
DecoderBool/Int/False-20                  0.00           0.00          ~     (all equal)
DecoderBool/Uint/True-20                  0.00           0.00          ~     (all equal)
DecoderBool/Uint/False-20                 0.00           0.00          ~     (all equal)
DecoderInt/Int-20                         0.00           0.00          ~     (all equal)
DecoderInt/Uint-20                        0.00           0.00          ~     (all equal)
DecoderInt/Float-20                       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
DecoderUint/Int-20                        0.00           0.00          ~     (all equal)
DecoderUint/Uint-20                       0.00           0.00          ~     (all equal)
DecoderUint/Float-20                      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
DecoderFloat/Int-20                       0.00           0.00          ~     (all equal)
DecoderFloat/Uint-20                      0.00           0.00          ~     (all equal)
DecoderFloat/Float-20                     0.00           0.00          ~     (all equal)
DecoderString/Binary-20                   1.00 ± 0%      0.00          ~     (p=0.100 n=3+3)
DecoderString/String-20                   1.00 ± 0%      0.00          ~     (p=0.100 n=3+3)
DecoderByteSlice/Binary-20                0.00           0.00          ~     (all equal)
DecoderByteSlice/String-20                0.00           0.00          ~     (all equal)
DecoderInterface/Bool/True-20             0.00           0.00          ~     (all equal)
DecoderInterface/Bool/False-20            0.00           0.00          ~     (all equal)
DecoderInterface/Int-20                   0.00           0.00          ~     (all equal)
DecoderInterface/Uint-20                  0.00           0.00          ~     (all equal)
DecoderInterface/Float-20                 0.00           0.00          ~     (all equal)
DecoderInterface/String-20                0.00           0.00          ~     (all equal)
DecoderInterface/ArrayLen-20              1.00 ± 0%      1.00 ± 0%     ~     (all equal)
DecoderInterface/MapLen/String-20         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
DecoderInterface/MapLen/Interface-20      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
DecoderInterface/Nil-20                   0.00           0.00          ~     (all equal)
UnpackUint8-20                            0.00           0.00          ~     (all equal)
UnpackUint16-20                           0.00           0.00          ~     (all equal)
UnpackUint32-20                           0.00           0.00          ~     (all equal)
UnpackUint64-20                           0.00           0.00          ~     (all equal)
UnpackFixInt8-20                          0.00           0.00          ~     (all equal)
UnpackInt8-20                             0.00           0.00          ~     (all equal)
UnpackInt16-20                            0.00           0.00          ~     (all equal)
UnpackInt32-20                            0.00           0.00          ~     (all equal)
UnpackInt64-20                            0.00           0.00          ~     (all equal)
UnpackFloat32-20                          0.00           0.00          ~     (all equal)
UnpackFloat64-20                          0.00           0.00          ~     (all equal)
UnpackString-20                           2.00 ± 0%      1.00 ± 0%     ~     (p=0.100 n=3+3)
UnpackArray/Uint-20                       0.00           0.00          ~     (all equal)
UnpackArray/Binary-20                     0.00           0.00          ~     (all equal)
UnpackMap-20                              0.00           0.00          ~     (all equal)
_correctFilels/Named-20                   96.0 ± 0%      96.0 ± 0%     ~     (all equal)
_correctFilels/Empty-20                   96.0 ± 0%      96.0 ± 0%     ~     (all equal)
_correctFilels/OmitEmpty-20               96.0 ± 0%      96.0 ± 0%     ~     (all equal)
EncodeMpack/api-20                        1.00 ± 0%      1.00 ± 0%     ~     (all equal)
EncodeMpack/api_metadata-20               1.00 ± 0%      1.00 ± 0%     ~     (all equal)
EncodeMpack/api_metadata/Empty-20        5.57k ± 0%     5.57k ± 0%     ~     (all equal)
EncodeMpack/funcs_data-20                 1.00 ± 0%      1.00 ± 0%     ~     (all equal)
DecodeMpack/api-20                        2.00 ± 0%      2.00 ± 0%     ~     (all equal)
DecodeMpack/api_metadata-20              1.34k ± 0%     0.00k ± 0%     ~     (p=0.100 n=3+3)
DecodeMpack/api_metadata/Empty-20        1.34k ± 0%     0.00k ± 0%     ~     (p=0.100 n=3+3)
DecodeMpack/funcs_data-20                 2.00 ± 0%      2.00 ± 0%     ~     (all equal)
[Geo mean]                                3.69           3.09       -16.29%

name                                  old speed      new speed      delta
Decode/Bool/False-20                  16.7MB/s ± 1%  16.1MB/s ± 0%     ~     (p=0.100 n=3+3)
Decode/Bool/True-20                   16.6MB/s ± 1%  16.1MB/s ± 2%     ~     (p=0.200 n=3+3)
Decode/Uint8-20                       14.8MB/s ± 1%  14.4MB/s ± 1%     ~     (p=0.100 n=3+3)
Decode/Uint16-20                      21.1MB/s ± 1%  20.5MB/s ± 0%     ~     (p=0.100 n=3+3)
Decode/Uint32-20                      34.9MB/s ± 1%  34.3MB/s ± 0%     ~     (p=0.100 n=3+3)
Decode/Uint64-20                      59.4MB/s ± 1%  58.3MB/s ± 1%     ~     (p=0.100 n=3+3)
Decode/FixInt8-20                     15.7MB/s ± 1%  15.2MB/s ± 1%     ~     (p=0.100 n=3+3)
Decode/Int8-20                        14.4MB/s ± 0%  13.9MB/s ± 3%     ~     (p=0.100 n=3+3)
Decode/Int16-20                       20.7MB/s ± 1%  20.0MB/s ± 1%     ~     (p=0.100 n=3+3)
Decode/Int32-20                       34.3MB/s ± 0%  33.1MB/s ± 1%     ~     (p=0.100 n=3+3)
Decode/Int64-20                       59.6MB/s ± 1%  57.3MB/s ± 2%     ~     (p=0.100 n=3+3)
Decode/Float32-20                     34.2MB/s ± 0%  33.6MB/s ± 1%     ~     (p=0.100 n=3+3)
Decode/Float64-20                     59.5MB/s ± 1%  57.7MB/s ± 1%     ~     (p=0.100 n=3+3)
Decode/String-20                      2.48GB/s ± 1%  4.59GB/s ± 0%     ~     (p=0.100 n=3+3)
Decode/StringBytes-20                 4.26GB/s ± 0%  4.24GB/s ± 0%     ~     (p=0.200 n=3+3)
Decode/Binary-20                      4.29GB/s ± 0%  4.27GB/s ± 0%     ~     (p=0.200 n=3+3)
Decode/Array/String-20                 110kB/s ± 0%   200kB/s ± 0%     ~     (p=0.100 n=3+3)
Decode/Array/Uint64-20                3.94MB/s ± 1%  3.82MB/s ± 1%     ~     (p=0.100 n=3+3)
Decode/Map/String-20                   110kB/s ± 0%  1527kB/s ± 1%     ~     (p=0.100 n=3+3)
Decode/Map/Interface-20               1.33MB/s ± 1%  1.32MB/s ± 2%     ~     (p=0.600 n=3+3)
UnpackUint8-20                        88.6MB/s ± 4%  82.9MB/s ± 3%     ~     (p=0.100 n=3+3)
UnpackUint16-20                        114MB/s ± 3%   104MB/s ± 1%     ~     (p=0.100 n=3+3)
UnpackUint32-20                        187MB/s ± 3%   171MB/s ± 4%     ~     (p=0.100 n=3+3)
UnpackUint64-20                        325MB/s ± 1%   308MB/s ± 3%     ~     (p=0.100 n=3+3)
UnpackFixInt8-20                       143MB/s ± 5%   108MB/s ± 1%     ~     (p=0.100 n=3+3)
UnpackInt8-20                         90.8MB/s ± 1%  81.0MB/s ± 1%     ~     (p=0.100 n=3+3)
UnpackInt16-20                         106MB/s ± 3%   100MB/s ± 3%     ~     (p=0.100 n=3+3)
UnpackInt32-20                         176MB/s ± 3%   166MB/s ± 3%     ~     (p=0.100 n=3+3)
UnpackInt64-20                         341MB/s ± 0%   310MB/s ± 2%     ~     (p=0.100 n=3+3)
UnpackFloat32-20                       172MB/s ± 3%   164MB/s ± 3%     ~     (p=0.100 n=3+3)
UnpackFloat64-20                       327MB/s ± 3%   309MB/s ± 1%     ~     (p=0.100 n=3+3)
UnpackString-20                       2.69GB/s ± 0%  4.89GB/s ± 1%     ~     (p=0.100 n=3+3)
UnpackArray/Uint-20                    697MB/s ± 3%   660MB/s ± 2%     ~     (p=0.100 n=3+3)
UnpackArray/Binary-20                 16.5GB/s ± 1%  16.5GB/s ± 2%     ~     (p=1.000 n=3+3)
UnpackMap-20                          1.50GB/s ± 3%  1.42GB/s ± 3%     ~     (p=0.100 n=3+3)
EncodeMpack/api-20                    1.15TB/s ± 2%  1.18TB/s ± 0%     ~     (p=0.100 n=3+3)
EncodeMpack/api_metadata-20           2.27GB/s ± 1%  2.08GB/s ± 3%     ~     (p=0.100 n=3+3)
EncodeMpack/api_metadata/Empty-20      808MB/s ± 1%   750MB/s ± 5%     ~     (p=0.100 n=3+3)
EncodeMpack/funcs_data-20              246GB/s ± 1%   252GB/s ± 1%     ~     (p=0.200 n=3+3)
DecodeMpack/api-20                    9.26GB/s ±11%  9.04GB/s ± 2%     ~     (p=0.700 n=3+3)
DecodeMpack/api_metadata-20            729MB/s ± 2%  1404MB/s ± 3%     ~     (p=0.100 n=3+3)
DecodeMpack/api_metadata/Empty-20      675MB/s ± 2%  1122MB/s ± 3%     ~     (p=0.100 n=3+3)
DecodeMpack/funcs_data-20             3.55GB/s ± 1%  3.28GB/s ± 1%     ~     (p=0.100 n=3+3)
[Geo mean]                             181MB/s        197MB/s        +9.29%
  • Loading branch information
zchee committed Jan 18, 2021
1 parent 2edb567 commit cb7cb3d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion msgpack/unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"math"
"unsafe"
)

// Type represents the type of value in the MessagePack stream.
Expand Down Expand Up @@ -121,7 +122,7 @@ func (d *Decoder) BytesNoCopy() []byte {

// String returns the current String, Binary or Extension value as a string.
func (d *Decoder) String() string {
return string(d.p)
return *(*string)(unsafe.Pointer(&d.p))
}

// Int returns the current Int value.
Expand Down

0 comments on commit cb7cb3d

Please sign in to comment.