Hello,
I was wondering what are the heuristics (if any) that the compiler uses to decide whether to use the @generated branch instead of the normal branch. The docs remain a little bit vague and only talk about this as a performance optimization, but in a trimming world taking the @generated branch or not might mean being able to compile vs not.
For example, say you have a @generated function. It’s a pretty heavy function and the first compilation takes quite a while, but it’s what makes it possible to actually make the verifier happy.
It’s not a performance sensitive function, and when used in a REPL, it would be more than fine to just use dynamic dispatch and don’t incur in the compilation time of the @generated function.
If I were to change that function to an if @generated body, do I get the best of both worlds:
@generatedduring trimming, and dynamic dispatch in the REPL
or the worst of both:
- dynamic during trimming and
@generatedin the REPL?
a mix of both? Is this something that can be relied upon?
Thanks