You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you explain the reason for the Bufferish.from call and what it is doing?
We recently started using msgpack-lite in our project and in doing some performance profiling found that a large amount of time is spent read-format.js:bin_buffer. More investigation shows that on line 95 buf is a Uint8Array, and the result of Bufferish.from(buf) returns a Uint8array with the exact same data. What is the reason for the call to Buffer.from(buf)?
Given a Uint8Array Bufferish.from ends up calling its own slice. So what ends up happening is you get a redundant slice called and for lots of data that is expensive.
I made a quick hack and in our project just returned buf without doing Bufferish.from and everything worked fine. However, I think tried to modify the msgpack-lite library myself and that caused tests to fail. That obviously meant I was missing something.
My guess is that for a large number of cases the Bufferis.from call does not need to be called and would save a lot of processing time.
The text was updated successfully, but these errors were encountered:
Can you explain the reason for the Bufferish.from call and what it is doing?
We recently started using msgpack-lite in our project and in doing some performance profiling found that a large amount of time is spent read-format.js:bin_buffer. More investigation shows that on line 95
buf
is a Uint8Array, and the result ofBufferish.from(buf)
returns a Uint8array with the exact same data. What is the reason for the call to Buffer.from(buf)?Given a Uint8Array Bufferish.from ends up calling its own slice. So what ends up happening is you get a redundant slice called and for lots of data that is expensive.
I made a quick hack and in our project just returned buf without doing Bufferish.from and everything worked fine. However, I think tried to modify the msgpack-lite library myself and that caused tests to fail. That obviously meant I was missing something.
My guess is that for a large number of cases the Bufferis.from call does not need to be called and would save a lot of processing time.
The text was updated successfully, but these errors were encountered: