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

Standard optimization: O(1) dispatch using simple-vector when all branches are constants #1

Closed
Hexstream opened this issue Aug 28, 2019 · 0 comments

Comments

@Hexstream
Copy link
Owner

If all branches can be determined to be constants at compile-time, then we can just eval all of them into a static simple-vector at compile-time, thus getting O(1) dispatch on all implementations.

There should also be a way to use a similar strategy if not all the branches are constant, but a certain threshold of the branches are (75%?). In that case, we do the O(1) dispatch into the simple-vector, and we get a distinguished value (e.g. a special private symbol) if that branch is not a constant, and then we proceed to distinguish among the non-constant cases with the main strategy.

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

1 participant