James M Snell
e8cdfd3c2b
stream: reduce per-chunk overhead in stream/iter consumers
...
bytes(), text(), arrayBuffer(), array() and their sync variants kept a
snapshot object for every collected chunk, plus a batch entry and its
views array, so they can detect chunks that were resized or detached
before the result is assembled. For streams of many small chunks this
dominated memory use: collecting 1,000,000 one-byte chunks peaked at
about 490 MB of heap for 1 MB of data.
A non-empty view of a fixed-length, non-shared ArrayBuffer can only
change by its buffer being detached, which makes its byteLength 0, so
recording its byteLength is enough. Keep a full snapshot only for
empty views and views of resizable or shared buffers. The same input
now peaks at about 60 MB and is collected about five times faster.
Assisted-by: OpenCode
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/66483
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2026-10-10 17:56:18 +00:00
..
2026-10-07 15:38:44 -03:00
2026-10-08 09:58:29 +00:00
2026-10-05 16:47:38 +00:00
2026-10-07 15:39:57 -03:00
2026-10-07 15:38:44 -03:00
2026-10-07 15:38:44 -03:00
2026-10-07 15:38:44 -03:00
2026-10-07 15:38:44 -03:00
2026-10-07 15:38:44 -03:00
2026-10-07 15:39:57 -03:00
2026-10-07 15:38:44 -03:00
2026-10-07 15:39:57 -03:00
2026-10-07 15:39:57 -03:00
2026-10-07 15:39:57 -03:00
2026-10-07 15:38:44 -03:00
2026-10-07 15:38:44 -03:00
2026-10-07 15:38:44 -03:00
2026-10-07 15:38:44 -03:00
2026-10-05 16:47:38 +00:00
2026-10-05 11:25:07 +00:00
2026-10-05 16:47:38 +00:00
2026-10-03 16:24:37 +00:00
2026-10-05 16:47:39 +00:00
2026-10-07 13:36:40 +00:00
2026-10-07 13:36:48 +00:00
2026-10-03 08:32:22 +00:00
2026-10-05 16:47:38 +00:00
2026-10-04 22:38:33 +02:00
2026-10-10 11:21:51 +00:00
2026-10-10 11:21:51 +00:00
2026-10-10 11:21:51 +00:00
2026-10-10 11:21:51 +00:00
2026-10-05 05:16:57 +00:00
2026-10-05 05:16:57 +00:00
2026-10-05 11:25:07 +00:00
2026-10-10 17:56:05 +00:00
2026-10-10 17:56:05 +00:00
2026-10-10 17:56:04 +00:00
2026-10-10 08:29:37 +00:00
2026-10-10 13:02:45 +00:00
2026-10-06 11:36:02 +00:00
2026-10-06 11:36:02 +00:00
2026-10-06 11:36:02 +00:00
2026-10-06 17:40:45 +00:00
2026-10-05 11:25:07 +00:00
2026-10-05 05:47:29 +00:00
2026-10-05 21:26:47 +00:00
2026-10-05 21:26:47 +00:00
2026-10-05 21:26:47 +00:00
2026-10-05 21:26:47 +00:00
2026-10-05 21:26:47 +00:00
2026-10-05 21:26:47 +00:00
2026-10-10 08:29:51 +00:00
2026-10-08 20:58:31 +00:00
2026-10-05 16:47:38 +00:00
2026-10-03 09:51:01 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-06 17:40:30 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-06 17:17:15 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-06 05:55:47 +00:00
2026-10-05 16:47:38 +00:00
2026-10-05 16:47:38 +00:00
2026-10-08 03:54:07 +00:00
2026-10-10 14:36:38 +00:00
2026-10-09 15:53:53 +00:00
2026-10-07 06:41:31 +00:00
2026-10-07 02:13:23 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:29 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-10 17:56:14 +00:00
2026-10-10 17:56:14 +00:00
2026-10-07 20:01:29 +00:00
2026-10-10 17:56:17 +00:00
2026-10-10 17:56:15 +00:00
2026-10-07 20:01:31 +00:00
2026-10-10 17:56:18 +00:00
2026-10-10 17:56:09 +00:00
2026-10-07 20:01:31 +00:00
2026-10-10 17:56:10 +00:00
2026-10-07 20:01:31 +00:00
2026-10-07 20:01:31 +00:00
2026-10-03 09:50:25 +00:00
2026-10-04 22:40:57 +02:00
2026-10-05 05:17:09 +00:00
2026-10-04 19:16:34 +00:00
2026-10-07 13:36:37 +00:00
2026-10-05 07:00:09 +00:00
2026-10-03 07:35:17 +00:00