How to troubleshoot when precompilation takes a long time?

I’m working on a module and it’s taking longer and longer to precompile (now taking more like a minute). The code base isn’t too big, and it’s certainly going to grow bigger soon. I wonder if there’s any way to speed that up but I don’t even know where it’s taking time.

Is there a “profiler” for the compiler itself? How does everyone deal with this problem?

1 Like

If you’re on 1.2, consider @snoopi. If your concern is the precompilation time, this could be a little tricky since Julia spins up separate processes for precompilation. Perhaps with the right sequence of @snoopi include("file1.jl") statements you can get the information you want. Keep in mind this attributes all the time to “root” methods (the ones that initially trigger inference), lumping together all the the time spent inferring their callees.

The “shorten precompile times” of SnoopCompile doesn’t really work very well due to limitations in Julia itself, but at least you should be able to diagnose the problem. And hopefully the limitations should be addressed in the near future.

3 Likes