From 79e86ac5fd9e1fdc44493af2155bb823cea7b41f Mon Sep 17 00:00:00 2001 From: ryan jarvinen Date: Tue, 12 Nov 2019 07:13:48 -0800 Subject: [PATCH] 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 Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil Reviewed-By: Denys Otrishko Reviewed-By: Trivikram Kamat --- lib/internal/js_stream_socket.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/internal/js_stream_socket.js b/lib/internal/js_stream_socket.js index ebe90cccc75f45..cdf6cd7ac7e5bd 100644 --- a/lib/internal/js_stream_socket.js +++ b/lib/internal/js_stream_socket.js @@ -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();