fix: replace node buffers with uint8arrays#51
fix: replace node buffers with uint8arrays#51achingbrain wants to merge 1 commit intodignifiedquire:masterfrom achingbrain:fix/replace-node-buffers-with-uint8arrays
Conversation
All use of node Buffers have been replaced with Uint8Arrays BREAKING CHANGES: - `cbor.encode` used to return a Buffer, now it returns a Uint8Array
|
Very nice work, but Before After I recall hearing 3rd hand (I haven't tested for myself and I think it was @mikeal who told me that someone told him), that the various Makes me think I need to build more benchmarking into the things I'm currently converting! |
| size += resultLength[i] | ||
| } | ||
|
|
||
| var res = Buffer.allocUnsafe(size) |
There was a problem hiding this comment.
This is probably where the perf difference is coming from.
There’s no equivalent to this outside of Node.js, so this change is moving us from a request for an already allocated piece of dirty memory to a new allocation of zero’d memory.
All use of node Buffers have been replaced with Uint8Arrays
BREAKING CHANGES:
cbor.encodeused to return a Buffer, now it returns a Uint8Array