Precompilation after Julia Update

Hi,

updating Julia versions can be annoying because precompilation for big projects take quite long.

I thought it’s clever to do the update, and then run a script which activates all my dev folders and instantiates them. That should trigger precompilation for many packages. Especially on my Laptop this seems to help a lot:

Just run this function, takes some minutes but then most of the stuff should be precompiled.

using Pkg 

function precompile_dev_folders()
    cd("/home/fxw/.julia/dev")
    for folder in readdir()
        if isdir(folder)
            println("In folder: $folder")
            cd(folder)
            try
                Pkg.activate(".")
                Pkg.instantiate()
                try
                    cd("examples")
                    Pkg.activate(".")
                    Pkg.instantiate()
                    cd("..")
                catch
                    println("No examples in $folder")
                end
            catch e
                println("Error in folder: $folder")
                println(e)
            end
            cd("..")
        end
    end
end
4 Likes

This seems particularly focused on developers.

I think you could adapt this to go through recent Manifest.toml usage by using ~/.julia/logs/manifest_usage.toml

1 Like