Files
node/lib
James M Snell e6c9c8eecd stream: construct stream/iter byte view snapshots and batch entries
createBatchEntry() and recordChunk() snapshot every chunk in a
seven-property `{ __proto__: null, ... }` literal, and every batch gets
a `{ __proto__: null, views, byteLength }` record. V8 creates such
literals in dictionary mode, which is expensive for objects created
for every chunk.

Create them with constructors whose prototype is an empty, frozen,
null-prototype object instead, as for IterResult. They have fast
properties and a single shape, and are only used internally.

Writing 1e6 16-byte chunks into a push() stream and reading them back
is about 6x faster with writeSync(), 3.7x faster with writevSync() (4
chunks per call) and 1.7x faster with string chunks.
benchmark/streams/iter-throughput-share-sync.js improves by 67-93%,
iter-throughput-share.js by 4-8%, and iter-throughput-broadcast.js
with 4 consumers by 8%. pipeTo() with small chunks is about 1.5x
faster.

Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/66648
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-10-15 13:26:47 +00:00
..
2026-09-03 15:37:21 +00:00
…
…
…
…
…
2026-10-15 00:52:34 +00:00
2026-10-15 00:52:34 +00:00
2026-10-15 00:52:34 +00:00
2026-10-15 00:52:34 +00:00
2026-10-15 00:52:34 +00:00
2026-10-15 00:52:34 +00:00
…
2026-09-05 02:49:02 +00:00
2026-09-28 04:22:37 +00:00
2026-09-12 11:52:10 +00:00
2026-09-03 11:40:52 +02:00
2026-10-04 03:56:13 +00:00
…
2026-10-15 00:52:34 +00:00
2026-10-15 00:52:34 +00:00
…
2026-10-05 21:26:47 +00:00
…
2026-07-25 23:56:46 -07:00
…
…
…
…
2026-08-23 15:52:12 +00:00
…
2026-09-03 11:48:46 +02:00
2026-10-15 07:53:03 +00:00