Skip to content

Commit

Permalink
stream: improve read() performance
Browse files Browse the repository at this point in the history
PR-URL: nodejs#28961
Reviewed-By: Weijia Wang <starkwang@126.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
mscdex authored and Trott committed Aug 7, 2019
1 parent 4c9fb0b commit 0b5b81c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/internal/streams/buffer_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 0b5b81c

Please sign in to comment.