timholy / SnoopCompile.jl

Provide insights about latency (TTFX) for Julia packages
https://timholy.github.io/SnoopCompile.jl/dev/
Other
309 stars 48 forks source link

Option to turn off all precompilation globally #298

Closed baggepinnen closed 1 year ago

baggepinnen commented 2 years ago

Since the introduction of SnoopPrecompile, I've noticed a rather dramatic impact on my developer productivity. As a developer of many different packages, many of them related to SciML, I precompile packages very often. I thus have very little benefit of any precompilation, which has lately been wasting 20 minutes multiple times per day.

I just learned that OrdinaryDiffEq is using Preferences.jl to allow the user to opt out of precompilation. Would it be possible to do something similar for SnoopPrecompile globally, using Preferences.jl or an environment variable? I would essentially like to turn off more or less all precompilation, since chances are rather high that I will not benefit from it at all until the next time I perform the same precompilation.

timholy commented 2 years ago

What happens if you start julia with julia --compiled-modules=no?

baggepinnen commented 2 years ago

--compiled-modules=no seems to make loading packages extremely slow

/home/fredrikb> julia --startup-file=no --compiled-modules=no 

julia> @time using ControlSystems
┌ Warning: Replacing docs for `SciMLBase.sol :: Union{Tuple, Tuple{D}, Tuple{S}, Tuple{N}, Tuple{T}} where {T, N, S, D}` in module `SciMLBase`
└ @ Base.Docs docs/Docs.jl:240
 81.987430 seconds (132.87 M allocations: 8.530 GiB, 3.21% gc time, 34.21% compilation time: 9% of which was recompilation)
/home/fredrikb> julia --startup-file=no --compiled-modules=yes

julia> @time using ControlSystems
[ Info: Precompiling ControlSystems [a6e380b2-a6ca-5380-bf3e-84a91bcd477e]
 15.364393 seconds (19.27 M allocations: 1.285 GiB, 2.41% gc time, 4.63% compilation time: 48% of which was recompilation)
timholy commented 2 years ago

Hmm, yeah, it also nixes the caching of lowered code.