AOT compilation (not to create an executable)

I try to improve the deployment of the new releases of my Julia web apps.

As of now, the users encounter some lags (and sometimes timeouts) every time I deploy a new version because of the JIT compilation.

This gets even worse as I am adding more process with addprocs() because every function needs to be compiled on every core.

The first idea is to write a script that would provoke the compilation of every function of the project. In this idea running all the unit tests on every core would work.
But this has the problem that it requires the unit testing coverage of my project to be perfect (which is not the case :sweat_smile:) and to modify all the functions that alter data to have some sort of “simulation” mode…

Another option would be to simulate navigation on the web app, but same problem as before, plus I can’t be sure that every function has been invoked on every core.

I would be glad to hear that there’s something to provoke AOT compilation of a project.

NOTE: I don’t want to create an executable with PackageCompiler.jl

1 Like

How would this help? What is the next step?

1 Like

Thank you @Azamat I didn’t know about SnoopCompile.jl, last time I checked PackageCompiler.jl was the only option.

So, I tried SnoopCompile.jl and it brought the first call from 10s to 9s. Better, but far from the few milliseconds that it should take.

So I ended up writing a small utility package that calls all the methods of a given module using some mock arguments. It is called BlindBake.jl

I just had the time to test if on a reasonably big web app project with hundreds of functions. It works as expected.
Tell me your thoughts about it, I will be glad to hear that having a package for that is really not necessary.