Replace bimap
dependency with a more efficient pair of maps, and arena-allocate slices.
#951
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This originally was a prerequisite for introducing some asymmetry (for finer-grained zombies) in the maps, which
bimap
made impossible because it guarantees 1:1 (even when usinginsert
instead ofinsert_no_overwrite
, what it does is it removes any entries related to either side first, then adds the new pair of entries).But it turned into a refactor of its own, once I realized I can get rid of per-entry allocations, using the power of
tcx.arena.dropless
. (an untyped arena that allows allocating individual values, or whole slices, as long as they're!Drop
- this works great because there is no "drop to remember", which reduces overhead and soundness complexity - and by using the slice feature, at the very leastVec
s can be replaced, and even entire data-recursive trees could be arena-allocated, even if it sadly doesn't generalize to e.g.HashMap
/BTreeMap
)I haven't profiled this but it might be a bit faster? We were being pretty wasteful before, esp.
lookup_type
would.clone()
variants ofSpirvType
that hadVec
s in them, whereas now it's merely copying&[T]
s.Probably best to review each commit separately, matching the refactor stages.