Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using WasmArrays in maps and related data structures #54961

Closed
mkustermann opened this issue Feb 20, 2024 · 1 comment
Closed

Consider using WasmArrays in maps and related data structures #54961

mkustermann opened this issue Feb 20, 2024 · 1 comment
Assignees
Labels
area-dart2wasm Issues for the dart2wasm compiler.

Comments

@mkustermann
Copy link
Member

In dart2wasm we currently use VM's base implementation for linked hash maps (_HashFieldBase with various mixins). The VMs implementation uses Uint32List for the index and non-growable List<Object?> for the data. This means means a map object in wasm consists actually of 5 objects we can reduce that to 3 objects by using WasmArray<>s for index + data. This also avoids extra cost on the indirect access.

The downside is we depart from sharing the code with VM, but we can still use shared mixins and try to keep in sync in their implementation.

There's associated data structures, e.g. iterators, that are similarly affected

/cc @osa1

@mkustermann mkustermann added the area-dart2wasm Issues for the dart2wasm compiler. label Feb 20, 2024
@osa1
Copy link
Member

osa1 commented Feb 29, 2024

@osa1 osa1 self-assigned this Feb 29, 2024
@osa1 osa1 changed the title Consider using WasmArray<>s maps and related data structures Consider using WasmArrays in maps and related data structures Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dart2wasm Issues for the dart2wasm compiler.
Projects
None yet
Development

No branches or pull requests

2 participants