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

Generate cascading switch statements when number of bindings is large #8

Closed
Jeffset opened this issue Dec 27, 2022 · 0 comments · Fixed by #14
Closed

Generate cascading switch statements when number of bindings is large #8

Jeffset opened this issue Dec 27, 2022 · 0 comments · Fixed by #14
Labels
performance Performance issue/enhancement
Milestone

Comments

@Jeffset
Copy link
Contributor

Jeffset commented Dec 27, 2022

Yatagan, as Dagger in fastInit uses "switching providers" mechanism to reduce classloading. This means that for every binding, that can't be created inline (has Lazy/Provider usages) there's an index assigned. And every provider/lazy object instantiates the binding using the index and a lookup (switch) table.

Now, the hypothesis is, that when the lookup table becomes very large, the performance is going to be penalized. Yatagan currently generates plain switch statement, while Dagger did so with only up to 100 objects, after that it generated another switch level with index % 100 labels.

Let's try to investigate and possibly introduce the optimization.

Might be reasonable to do when the performance testing is implemented in #7

@Jeffset Jeffset added the performance Performance issue/enhancement label Dec 27, 2022
@Jeffset Jeffset added this to the 1.1.0 milestone Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance issue/enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant