Codegen performance megathread
kubukoz opened this issue · comments
Deliberately vague ticket name: I think we should do some proper profiling on the codegen to find the bottlenecks...
However, the first idea comes from #1458:
@Baccata: @ghostbuster91, if it's not too much to ask, would you mind applying the same logic to the codegen side of things when you have a little time ? It may help the build-time when generating code from big models
My 5 cents:
In smithy-codegen there's a TopologicalIndex
that can tell you if a shape is recursive: https://github.com/smithy-lang/smithy/blob/642b1fff01d1bccdc7729cad828470daee0bf113/smithy-codegen-core/src/main/java/software/amazon/smithy/codegen/core/TopologicalIndex.java#L179
I didn't check the algorithm used to check the recursion, but this could be a suitable alternative to our handcrafted recursion check.
I think the performance of compilation can also be included here...
AFAIK we're generating (or aiming to generate) type annotations for all public symbols, which should be helpful for the compiler. Anything else we can do?
We'll have to balance this with readability, though, so things like manually injecting implicits are probably off the table.