218 composable dispatcher #5
Open
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.
as of 4a33cb3 ; this uses TypeId to be explicit about how each specific types are handled, here are the current handled interactions:
Testing
This implementation allows us to test which combination of shapes are supported (and eventually the path taken).
Details
Benchmarking
Unfortunately, this implementation comes at a performance price:
❓ We may want to explore a mixed approach, where known shapes are "hardcoded" in matches to keep the performance, then the function dispatch is considered before reaching out for generic implementations.
To be noted the dispatcher creation is also costly compared to the "no-op" of
DefaultQueryDispatcher
. But the price should be paid only once at creation so it's not a hot path:Conclusion
TypeId::of
not being const makes it difficult to implement (Tracking Issue forconst fn
type_id
rust-lang/rust#77125).