Benchmarks showed improvements or no change across all tests. Notably, 100MB Read improved from ~13s to ~3s.
The magic value of 64 KiB was selected based on Node.js's default of 16 KiB in similar code [1] and manually testing some multiples over that (Node.js tends to be conservative).
[1] https://github.com/nodejs/node/blob/
f69f90d97a30cf9a5f7cbe0260e487ae4d457ed5/lib/internal/fs/promises.js#L317
return new ReadableStream({
type: 'bytes',
- autoAllocateChunkSize: 1024,
+ autoAllocateChunkSize: 65536, // 64 KiB
async start() {
handle = await open(path, "r");
resolveReady();