SparseIR.jl icon indicating copy to clipboard operation
SparseIR.jl copied to clipboard

Long precompilation times

Open mwallerb opened this issue 2 years ago • 6 comments

SparseIR is now super-fast to load. However, it does take quite long to precompile.

I don't understand why this should be, since we mostly do bog-standard linear algebra ... or is the quad-precision linear algebra just much slower?

Quite a small issue, but it is a little annoying :)

mwallerb avatar Jul 22 '23 06:07 mwallerb

On my Macbook Pro M1

julia> @time Base.compilecache(Base.identify_package("SparseIR"))
[ Info: Precompiling SparseIR [4fe2279e-80f0-4adb-8463-ee114ff56b7d]
 20.228946 seconds (3.60 k allocations: 326.414 KiB)

Yes, it is a bit long, although I was not aware of this issue.

shinaoka avatar Jul 22 '23 23:07 shinaoka

Disabling quad-precision (i.e. replacing Float64x2 by Float64) reduces precompilation from ~45 to ~30 seconds on my laptop. I have tried in the past to speed this up, but don't really have a clue how to diagnose where the time is spent.

SamuelBadr avatar Jul 25 '23 11:07 SamuelBadr

As of Julia 1.9, Julia introduced Package images.

https://docs.julialang.org/en/v1/devdocs/pkgimg/#pkgimages.

Package images are shared libraries that contain both code and data. Like .ji cache files, they are generated per package.

This feature lets us quickly load SparseIR.jl (i.e., using SparseIR). However, it increases the time for precompilation.

image

terasakisatoshi avatar Dec 12 '24 08:12 terasakisatoshi

Maybe using julia --pkgimage=no solves our issue.

image

terasakisatoshi avatar Dec 12 '24 08:12 terasakisatoshi

But, in the end, we will switch the backend of SparseIR.jl to C++/C. The precompilation time will be reduced then.

shinaoka avatar Dec 12 '24 08:12 shinaoka

In 1.12, there are tools to profile precompilation https://docs.julialang.org/en/v1.12-dev/manual/performance-tips/#Reducing-precompilation-time. Haven't yet tried it though.

SamuelBadr avatar Dec 12 '24 08:12 SamuelBadr