Skip to content

memoryFileSystemDriver write has O(n^2) overhead due to repeatedly concatenating buffers #244

Description

See

private write(content: Uint8Array, _offset: bigint, buffers: Uint8Array[]): [Uint8Array, size] {
, 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 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions