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

Improve handling of indexed types #35

Closed
ouz-a opened this issue Sep 13, 2023 · 1 comment
Closed

Improve handling of indexed types #35

ouz-a opened this issue Sep 13, 2023 · 1 comment

Comments

@ouz-a
Copy link

ouz-a commented Sep 13, 2023

Currently our implementation of indexed types such as AllocId, DefId, and soon rust-lang/rust#115772 Span relies on https://github.com/rust-lang/rust/blob/master/compiler/rustc_smir/src/rustc_internal/mod.rs#L141-L154 this kind of brute way of doing things, this is fine for our small use cases but @oli-obk thinks and suggests this is going to be a problem in the future when we face real-world use cases where thousands of ids will be iterated, they suggest we should add a hasmap from value to index per table to improve our handling of these types.

@oli-obk
Copy link
Contributor

oli-obk commented Sep 13, 2023

Ideally, instead of duplicating that logic per type, we'd find something that provides this behaviour on crates.io or we write our own helper

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 10, 2023
In smir use `FxIndexMap` to store indexed ids

Previously we used `vec` for storing indexed types, which is fine for small cases but will lead to huge performance issues when we use `smir` for real world cases.

Addresses rust-lang/project-stable-mir#35

r? `@oli-obk`
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Oct 10, 2023
In smir use `FxIndexMap` to store indexed ids

Previously we used `vec` for storing indexed types, which is fine for small cases but will lead to huge performance issues when we use `smir` for real world cases.

Addresses rust-lang/project-stable-mir#35

r? ``@oli-obk``
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 10, 2023
Rollup merge of rust-lang#116560 - ouz-a:efficient_ids, r=oli-obk

In smir use `FxIndexMap` to store indexed ids

Previously we used `vec` for storing indexed types, which is fine for small cases but will lead to huge performance issues when we use `smir` for real world cases.

Addresses rust-lang/project-stable-mir#35

r? ``@oli-obk``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants