Skip to content

Commit ab25a82

Browse files
ryanjtargos
authored andcommitted
lib: adding perf notes js_stream_socket.js
Leaving var in place of let for performance optimization in short loops in hot paths. Added comments explaining why. PR-URL: #30415 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 8a63ea1 commit ab25a82

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/internal/js_stream_socket.js

+1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ class JSStreamSocket extends Socket {
157157
let pending = bufs.length;
158158

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

0 commit comments

Comments
 (0)