Help reducing compilation and inference time

I suspect this is measuring the backend (mostly LLVM) of the compiler, which does not show up in a lot of profiles.

A slight clarification. I believe the left cluster is actually measuring the compilation of your code, whereas the right one is measuring the runtime. That’s why you see functions related to type inference and whatnot on the left. The profile is likely compiler front + middle end (left cluster) → compiler backend (middle valley) → runtime (right cluster).

It’s notable that running with -O0 removes so much of the middle area. Have you checked if TTFX is faster? If it is, then it’s worth looking into which functions are giving LLVM a hard time. I can provide general tips such as not @inlineing every function and avoiding large tuples, but it would be a good idea to see what people who have experience troubleshooting this stuff have to say.

2 Likes