-
Notifications
You must be signed in to change notification settings - Fork 443
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
Research reducing monomorphization bloat by delegating to non-generic implementations #910
Comments
We might also find a lot of use for this technique in heavily used derive dependencies such as |
That's a good point. And also a reminder of why the compiler team efforts are necessary despite any of the changes we will make to ink! (i.e. third party crates which have monomorphization bloat). |
I always wondered what that |
What do you think about rewriting the I think that the combination of #916 really will reduce the size of the contract. BTW, adding the getter/setter/method to the contract adds ~0.3kb, maybe we also can try to reduce code-generation for |
Dynamic dispatch is not always the cure but also brings plenty of problems with it sometimes. We see the biggest bloat in the |
Just linking #873 (comment) for reference. This is a method to check for monomorphization bloat. Maybe we can even add convenience command to cargo contract? |
These two blog posts describe techniques for reducing monomorphization bloat by having only a thin generic interface layer, which immediately delegates to a non-generic implementation:
https://llogiq.github.io/2019/05/18/momo.html
https://matklad.github.io/2021/09/04/fast-rust-builds.html
The Hackernews comments also contain some good ideas: https://news.ycombinator.com/item?id=28425095.
There is also the momo crate, which implements a macro for this technique.
We should look into if this is applicable to ink!.
The text was updated successfully, but these errors were encountered: