stream: reduce allocations in StreamBase reads and writes

Closed
MC
2mo ago
+406-114

Read buffers are now allocated from a 64KB slab and handed to JS as views (no per-read allocation, map bookkeeping, or resize copy), and WriteWrap objects are only created when a write does not complete synchronously.

net/net-pipe.js len=1024 type=buf                  +28.4%  (t=22.8)
net/net-c2s.js len=1024 type=buf                   +21.2%  (t=18.0)
net/net-pipe.js len=65536 type=buf                  +4.4%  (t=7.4)
tls/throughput-c2s.js size=16384 type=buf           +2.9%  (t=3.0)
net/tcp-raw-pipe.js, net-s2c, tls s2c              neutral