-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
As it is, if you have some Uint8Array that is a view into a larger ArrayBuffer then a copy of the data is made in encode because new Uint8Array(someOtherUint8Array) makes new ArrayBuffer with a copy of the data. Where as you could just use the Uint8Array passed in?
Basically this would change
exports.encode = function(arraybuffer) {
var bytes = new Uint8Array(arraybuffer),
To something like
exports.encode = function(arraybuffer) {
var bytes = (arrayBuffer instanceof Uint8Array || arrayBuffer instanceof Uint8ClampArray)
? arrayBuffer
: new Uint8Array(arraybuffer),
joaobaroni and adam-rocskaadam-rocska
Metadata
Metadata
Assignees
Labels
No labels