microsoft / microsoft/vscode-wasm
memoryFileSystemDriver write has O(n^2) overhead due to repeatedly concatenating buffers
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 456
- Forks
- 40
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 4
Description
See https://github.com/microsoft/vscode-wasm/blob/5932f9ac413dc788ec772f71dd4e6714ac7c9d57/wasm-wasi-core/src/common/memoryFileSystemDriver.ts#L214, when a lot of small writes happen, there's an O(n^2) overhead due to repeatedly concatenating buffers and copying over old content. Might also be the culprit of #234.
I noticed this when working on https://github.com/bjorn3/browser_wasi_shim/pull/95; almost all wasi in-memory vfs implementation written in js/ts I can find has the same issue, including this one.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at wasm-wasi-core/src/common/memoryFileSystemDriver.ts#L214 and inspect how repeated small writes build and copy buffer contents. Exercise the memory file system with many small writes, then verify that the resulting data remains correct and that the repeated-copying overhead is removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100