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
when migrating to uint8 from node buffer, code which used .slice was not changed, node:buffer's slice creates a subarray, but uint8.slice creates a copy, this needs to be updated to use .subarray, this would be another very big performance gain
The text was updated successfully, but these errors were encountered:
// Original code with Node.js Buffer
const originalBuffer = Buffer.from(/* some data */);
const subBuffer = originalBuffer.slice(10, 20); // Creates a subarray
// Updated code using Uint8Array
const uint8Array = new Uint8Array(/* some data */);
const subArray = uint8Array.subarray(10, 20); // Creates a view without copying
when migrating to uint8 from node buffer, code which used .slice was not changed, node:buffer's slice creates a subarray, but uint8.slice creates a copy, this needs to be updated to use .subarray, this would be another very big performance gain
The text was updated successfully, but these errors were encountered: