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: https://github.com/nodejs/node/pull/30415
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
ryan jarvinen authored and Myles Borins committed 2019-12-17 17:06:54 -05:00
1 parent e52237d66e
commit 7d0631aefc
1 file changed
+1
+1
View File
@@ -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();