msgpackr icon indicating copy to clipboard operation
msgpackr copied to clipboard

multiple Packr instances and useBuffer()

Open endel opened this issue 1 year ago • 1 comments

As the encoding Buffer is tied to the module scope (target), when using multiple Packr instances along with .useBuffer() - that Packr instance is not ensured to be using the correct Buffer.

A workaround would be to always call .useBuffer() prior to encoding, but that implies in creating a new DataView instance before each encode.

endel avatar Jun 28 '24 14:06 endel

Last commit will cache the DataView (as is done elsewhere in the code), so you can performantly switch buffers back and forth with useBuffer() (without new DataView each time).

kriszyp avatar Jul 14 '24 22:07 kriszyp