EDIT: I was mistaking the compilation time of the utiity package with its loading. See message below:
Original post:
Hello, I’m trying to improve the loading time of my code which is for the moment ruining my development productivity. I am using Revise.jl but still I very often need to restart my session and reload all my project’s code.
My first attempt has been to take out some of the code from the main project (MyMainProject) and put it in separate packages called PostgresqlDAO.
This package is not on github, I make it accessible to MyMainProject by using push!(LOAD_PATH, "/home/myuser/CODE/PostgresqlDAO.jl/")
In runtests.jl in my main project I now have the following:
using Pkg
Pkg.activate(".")
push!(LOAD_PATH, "/home/myuser/CODE/PostgresqlDAO.jl/")
using Revise
using Test
@time using TickTock, Random, Dates, UUIDs
@time using RDatasets # to check how long it takes to load a big package
@time using PostgresqlDAO
@time using TickTock, Random, Dates, UUIDs returns: 0.006625 seconds (21.84 k allocations: 1.161 MiB)
@time using RDatasets returns: 2.494468 seconds (6.75 M allocations: 379.499 MiB, 5.19% gc time)
@time using PostgresqlDAO returns: 7.691385 seconds (19.70 M allocations: 1014.108 MiB, 4.96% gc time)
The loading time of the code of PostgresqlDAO is actually the same as before (when it was embedded in MyMainProject).
I have the following message in the console which I interpret as PostgresqlDAO is recompiled every time I start a new session
[ Info: Recompiling stale cache file /home/myuser/.julia/compiled/v1.1/PostgresqlDAO/aXv1G.ji for PostgresqlDAO [9f278218-a07e-11e9-18c7-113e7cd19c36]
[ Info: Recompiling stale cache file /home/myuser/.julia/compiled/v1.1/MyMainProject/bj4UF.ji for MyMainProject [9f980d3e-8c05-11e9-23d2-ff41aa27f809]
┌ Warning: Package MyMainProject does not have PostgresqlDAO in its dependencies:
│ - If you have MyMainProject checked out for development and have
│ added PostgresqlDAO as a dependency but haven't updated your primary
│ environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with MyMainProject
└ Loading PostgresqlDAO into MyMainProject from project dependency, future warnings for MyMainProject are suppressed.
Is there a way to ‘cache’ the compilation of a local package?
If not what can I do? Does putting it on github as an unreferenced package would help?
In general, are there some good practices to improve the compilation time of our code?