Question about using SnoopPrecompile

One opportunity that probably most people are still not exploiting: with 1.8, the precompile work does not have to be in the package that “owns” the code. So what that means is that each user can construct a “personal Startup.jl” package and say using Startup at the beginning of a new session. So for example, if you like to use a combination of CSV, DataFrames, and StatsModels and want certain things to be fast, then you can Pkg.generate("Startup") in your dev folder and then the Startup package might look like this:

module Startup

using CSV, DataFrames, StatsModels     # all these should be in the Project.toml for Startup
using SnoopPrecompile

@precompile_setup begin
    data = ...
    @precompile_all_calls begin
        call_some_code(data, ...)
    end
end

end    # Startup module

Then the code for those packages you want to be fast will be cached in a *.ji file for Startup.jl.

28 Likes