Base.precompile appears not to work

In terms of the bigger picture, precompilation is still an evolving story in Julia. You might be surprised to hear it’s not “done,” but there are good reasons. Historically, Julia’s dynamic development model had one bad side effect: triggering invalidations which reduce the benefit of precompilation. In Julia versions up to and including 1.5, invalidations were so common that it wasn’t obvious that a big push on precompilation was worthwhile. Fortunately, starting in Julia 1.6 (which should enter release cycle soon), there will be relatively few invalidations, and so there’s some hope that in future versions of Julia we’ll make significant advances in precompilation.

That said, there will still be limitations to what precompile can do—most fundamentally, it is limited by type inference, and when inference fails it can’t necessarily do what you’re expecting it to do. See Understanding precompilation and its limitations (reducing latency) for a more detailed discussion.

The good news is that, even as of today, you can start preparing for a brave new world with really good precompilation by starting to analyze packages (ones you develop and/or use) for inference failures, and start fixing what problems you can. If that work is done ahead of time, the effect of advances in precompilation should be immediate and dramatic.

5 Likes