Skip to content

Commit

Permalink
lib: adding perf notes js_stream_socket.js
Browse files Browse the repository at this point in the history
Leaving var in place of let for performance optimization in short loops in hot paths. Added comments explaining why.
  • Loading branch information
ryanj committed Nov 26, 2019
1 parent cc6f99d commit 0c2391b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/internal/js_stream_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class JSStreamSocket extends Socket {
let pending = bufs.length;

this.stream.cork();
// Use `var` over `let` for performance optimization.
for (var i = 0; i < bufs.length; ++i)
this.stream.write(bufs[i], done);
this.stream.uncork();
Expand Down

0 comments on commit 0c2391b

Please sign in to comment.