See
|
if (requiredLength > file.node.content.byteLength) { |
,
fd_write always allocates a new buffer and copies over old content when appending content, which results in O(n^2) slowdown when doing a lot of small writes.
I noticed this when working on bjorn3/browser_wasi_shim#95; almost all wasi in-memory vfs implementation written in js/ts I can find has the same issue, including this one.