scikit-image icon indicating copy to clipboard operation
scikit-image copied to clipboard

Build once per platform & use ccache

Open stefanv opened this issue 9 months ago • 9 comments

See if we can speed up builds by caching meson build dir

stefanv avatar Mar 15 '25 00:03 stefanv

It looks like it's successful at restoring the cache, but it's not faster to build. It still counts from 1 to 165. Is it using the cache?

In retrospect, sorry for suggesting caching the build folder! I was just interested in the idea of caching the build, but knew I didn't know how to do it.

mdhaber avatar Mar 15 '25 01:03 mdhaber

Timestamps may be a problem. Not sure meson cache is meant to be restored like this.

stefanv avatar Mar 15 '25 04:03 stefanv

Could ccache be another option (in case you haven't thought of it already)?

lagru avatar Mar 16 '25 13:03 lagru

Yes, that's what I realized we'd have to do! You can't cache meson this way because of timestamps.

stefanv avatar Mar 16 '25 17:03 stefanv

We should not be building N times for a given Python version on a given platform. Build once, test several configurations?

stefanv avatar Mar 17 '25 05:03 stefanv

What configurations do you have other than different platforms/Python versions? Different versions of other dependencies?

(That said, this will already be a huge improvement, so besides getting the cache working, optimizations could be a follow-up.)

mdhaber avatar Mar 17 '25 05:03 mdhaber

For any given platform, we build with a known set of dependencies. But, you're right, that can be a secondary optimization.

stefanv avatar Mar 17 '25 05:03 stefanv

It doesn't look like ccache helped here :thinking:

stefanv avatar Mar 18 '25 06:03 stefanv

OK, the caching is roughly working. Takes a build down from ~4.5mins to ~1min. Will need to adjust the CI a bit, because looks like the caching is too granular. E.g., the pre-build still rebuilds from source, despite having access to a cache (hits: <2%).

stefanv avatar Mar 19 '25 08:03 stefanv