Skip to content

Commit 000999c

Browse files
mscdextargos
authored andcommitted
stream: improve read() performance
PR-URL: #28961 Reviewed-By: Weijia Wang <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent b7696b4 commit 000999c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/internal/streams/buffer_list.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
const { Buffer } = require('buffer');
44
const { inspect } = require('internal/util/inspect');
55

6-
function copyBuffer(src, target, offset) {
7-
Buffer.prototype.copy.call(src, target, offset);
8-
}
9-
106
module.exports = class BufferList {
117
constructor() {
128
this.head = null;
@@ -66,7 +62,7 @@ module.exports = class BufferList {
6662
var p = this.head;
6763
var i = 0;
6864
while (p) {
69-
copyBuffer(p.data, ret, i);
65+
ret.set(p.data, i);
7066
i += p.data.length;
7167
p = p.next;
7268
}

0 commit comments

Comments
 (0)