From: Feross Aboukhadijeh Date: Thu, 11 Feb 2021 03:32:36 +0000 (-0800) Subject: small perf improvement X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=57caad4450d241207066ca3832fb8e9095ad402f;p=buffer.git small perf improvement --- diff --git a/index.js b/index.js index 7a0e9c2..cc19926 100644 --- a/index.js +++ b/index.js @@ -410,7 +410,9 @@ Buffer.concat = function concat (list, length) { let buf = list[i] if (isInstance(buf, Uint8Array)) { if (pos + buf.length > buffer.length) { - if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) + if (!Buffer.isBuffer(buf)) { + buf = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) + } buf.copy(buffer, pos) } else { Uint8Array.prototype.set.call(