I put some effort into this every now and then, reading about packages for analyzing, and techniques, trying things. I have tried both precompile
and running code during precompilation. I have never seen any benefit. In fact, running somefunction(...)
in a let
block as above made TTFX slower in one case. That is, running somefunction(...)
the first time after using
the module took longer and allocated more. I know there are ways to investigate to find what to call or precompile, etc. But, it’s fairly complicated.
So in my case, it’s definitely not “written without much thought to startup time”. It’s that reducing start up time takes a lot of learning and a lot of time.