julia-actions / cache

A shortcut action to cache Julia artifacts, packages, and registries.
MIT License
38 stars 8 forks source link

Speedup by caching compilation depends on OS #85

Closed ArnoStrouwen closed 7 months ago

ArnoStrouwen commented 7 months ago

I am trying to figure out how much caching compilation helps speedup CI for a typical SciML use case: https://github.com/ArnoStrouwen/CITester.jl/blob/master/test/runtests.jl

On Windows I see a massive speedup, because everything was already nicely precompiled: https://github.com/ArnoStrouwen/CITester.jl/actions/runs/7399237038/job/20130173669#step:6:306 However, on Linux I only got a moderate speedup, and on Mac none at all. On those operating systems, testing needed to precompile everything again: https://github.com/ArnoStrouwen/CITester.jl/actions/runs/7399237038/job/20130172872#step:6:304

Is this difference between operating systems to be expected? Can I configure anything such that the same speedup as windows is achieved?

IanButterworth commented 7 months ago

So Julia v1.10.0 might actually be a regression in performance of this caching..

The issue is that caches depend on the mtime of stdlib caches, which are installed by the setup-julia action. i.e. newer than the cached depot, so triggers precompilation

1.9: most stdlibs are in the sysimage, so not many deps are affected by this 1.10: some stdlibs are removed so more deps are affected 1.11: moved away from mtime cache sensitivity to content tracking, so not an issue. happily avoids re-precompilation

To improve the situation on 1.10 I think we need to revive this for the release-1.10 branch https://github.com/JuliaLang/julia/pull/50919 and get it into 1.10.1

As for why it's different for different platforms.. I guess it's a filesystem/tar behavior difference.

IanButterworth commented 7 months ago

Turns out the julia archive mtimes are maintained on windows via julia-actions/setup-julia which explains why the precompilation caching is effective. https://github.com/julia-actions/setup-julia/pull/200

And setup-julia will soon have an mtime fix which will solve this for all platforms https://github.com/julia-actions/setup-julia/pull/196

IanButterworth commented 7 months ago

Should be fixed in https://github.com/julia-actions/setup-julia/releases/tag/v1.9.5