You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently associated-derive uses match to resolve which constant it should return. This is fine when used with enums with consecutive discriminants or non-consecutive but not too sparse as Rust will compile the match to a jump table (even in debug builds).
However if the discriminants are very sparse, it will fall back to checking one-by-one which is linear time complexity with the number of variants.
Having other resultion methods, like some sort of binary search or a precomputed static hash table, could be very useful in those circumstances. Before they can be built, the user needs a way to chose which method to use, currently just "Match".
The text was updated successfully, but these errors were encountered:
Currently associated-derive uses match to resolve which constant it should return. This is fine when used with enums with consecutive discriminants or non-consecutive but not too sparse as Rust will compile the match to a jump table (even in debug builds).
However if the discriminants are very sparse, it will fall back to checking one-by-one which is linear time complexity with the number of variants.
Having other resultion methods, like some sort of binary search or a precomputed static hash table, could be very useful in those circumstances. Before they can be built, the user needs a way to chose which method to use, currently just "Match".
The text was updated successfully, but these errors were encountered: