Repository navigation
Conversation
The server's per-connection request and response queues, the uncork() and end() callback lists in OutgoingMessage, and the socket sets in Agent.prototype.removeSocket() used .push() on private arrays, which looks up Array.prototype.push at call time. These files do not use prototype primordials, so replacing that method from user code changed how they ran. Use indexed assignments instead. Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
|
Review requested:
|
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #67885 +/- ##
==========================================
- Coverage 90.58% 90.57% -0.01%
==========================================
Files 802 802
Lines 286656 287048 +392
Branches 55369 55431 +62
==========================================
+ Hits 259668 260004 +336
- Misses 17089 17120 +31
- Partials 9899 9924 +25
π New features to boost your workflow:
|
Ethan-Arrowood
left a comment
There was a problem hiding this comment.
Unsure if you deliberately omitted these other two calls since they have multiple arguments. Going to approve for now but will wait on requesting CI until you confirm (or push another commit and then I'll reapprove and request CI).
There was a problem hiding this comment.
Still some push calls in here.
There was a problem hiding this comment.
these should probably use ArrayPrototypePush even if they can't be converted to the length syntax
There was a problem hiding this comment.
I think we avoid those in http files for performance reasons.
There was a problem hiding this comment.
these should probably use ArrayPrototypePush even if they can't be converted to the length syntax
@Ethan-Arrowood yes, that's deliberate. Those two calls push three values at once, so each would become: const buf = msg[kChunkedBuffer];
const i = buf.length;
buf[i] = chunk;
buf[i + 1] = encoding;
buf[i + 2] = callback;That's a lot of noise on the corked write path for little gain, and |
|
Hm... the principle of this PR (and the others) is that msg[kChunkedBuffer][msg[kChunkedBuffer].length] = chunk;
msg[kChunkedBuffer][msg[kChunkedBuffer].length] = encoding;
msg[kChunkedBuffer][msg[kChunkedBuffer].length] = callback;So we avoid any declarations. Performance-sensitive, secure code is not going to be pretty lol |
|
@Ethan-Arrowood updated on 4b458f4 ππΌ |
The server's per-connection
incoming/outgoingqueues, theuncork()andend()callback lists inOutgoingMessage, and the socket sets inAgent.prototype.removeSocket()used.push()on private arrays. If user code replacedArray.prototype.push, these paths went through it. This uses indexed assignments instead.lib/internal/http/*.jsmust not use prototype primordials, the same aslib/zlib.js, so this follows #67748. Private arrays only, no performance claim.