denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
94.79k stars 5.26k forks source link

fsFile writer slow #16667

Open OpenGG opened 1 year ago

OpenGG commented 1 year ago

Calling fsFile.writable.getWriter().write(new Uint8Array(128)) x 10M times takes 20s~30s to finish.

While Node.js writeStream().write(new Uint8Array(128)) only costs 1s.

Deno version: v1.28.0 Node verison: v18.12.0

See this repo: https://github.com/OpenGG/deno-node-fs-write

OpenGG commented 1 year ago

Performance issues with small buffers. Large buffers are fine. Write new Uint8Array(1M) x128 times, both deno and node take 0.7s.

Maybe something about internal write buffers? Node.js writeStream defaults to 16KB highWaterMark. What about deno?