Skip to content

memfs Node write has O(n^2) overhead due to repeatedly concatenating buffers #1211

@TerrorJack

Description

@TerrorJack

See

write(buf: Buffer, off: number = 0, len: number = buf.length, pos: number = 0): number {
, when a lot of small writes happen at the end of an inode, there can be O(n^2) slowdown due to repeatedly copying over old content to new buffers.

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions