From 000999c06c91dd40532efa0fc7c67edd1bf2e7c2 Mon Sep 17 00:00:00 2001 From: Brian White Date: Sun, 4 Aug 2019 17:39:45 -0400 Subject: [PATCH] stream: improve read() performance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/28961 Reviewed-By: Weijia Wang Reviewed-By: Michaƫl Zasso Reviewed-By: Anna Henningsen Reviewed-By: Yongsheng Zhang Reviewed-By: Trivikram Kamat Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: James M Snell --- lib/internal/streams/buffer_list.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/internal/streams/buffer_list.js b/lib/internal/streams/buffer_list.js index e0ba6e885cb60e..5bfa762e85d0a6 100644 --- a/lib/internal/streams/buffer_list.js +++ b/lib/internal/streams/buffer_list.js @@ -3,10 +3,6 @@ const { Buffer } = require('buffer'); const { inspect } = require('internal/util/inspect'); -function copyBuffer(src, target, offset) { - Buffer.prototype.copy.call(src, target, offset); -} - module.exports = class BufferList { constructor() { this.head = null; @@ -66,7 +62,7 @@ module.exports = class BufferList { var p = this.head; var i = 0; while (p) { - copyBuffer(p.data, ret, i); + ret.set(p.data, i); i += p.data.length; p = p.next; }