Open fonsp opened 1 year ago
Since this is performance-sensitive, we need a benchmark before making the switch
Simon Danisch was working with https://github.com/msgpack/msgpack-javascript and he found that they avoid some allocations: e.g. when part of a message is a Uint8Array
, that array will actually have a larger buffer as underlying data, but it uses the byteOffset
and byteLength
.
Our package gives the buffer already sliced, which must mean that we have more allocations! 🙄
According to their benchmark, they have a 2-3x performance increase compared to msgpack-lite!
They also have streaming API (using https://web.dev/streams/ ?) which should give even more speedups.
Right now we are using https://github.com/kawanet/msgpack-lite for the JS side of our MsgPack protocol, or actually, my fork https://github.com/fonsp/msgpack-lite/commit/699001171edfc1e990b14085917f869badfa4d5b where i directly edited the
.min.js
bundle to become an ES6 file 😅It's working great, and I think it is quite fast.
We could switch to https://github.com/msgpack/msgpack-javascript , which is being actively developed, and more modern: it is written for ES6.