windmill-labs / windmill

Open-source developer platform to power your entire infra and turn scripts into webhooks, workflows and UIs. Fastest workflow engine (13x vs Airflow). Open-source alternative to Retool and Temporal.
https://windmill.dev
Other
9.77k stars 453 forks source link

feature: use sscache to improve incremental compilation time for rust jobs #4369

Open rubenfiszel opened 2 weeks ago

pyranota commented 1 week ago

Im not sure if sccache will help with incremental compilation. It helps with rebuilding entire project alot, but is not that effective when incrementally rebuilding project with small changes. Sccache caches artifacts, but when we make a change, than produced artifact changes as well and sccache can not provide that new artifact and cache miss occurs. I think the best way to improve comptime speed is to use nightly rust with optimization flags and cranelift as a backend. Still tho approach with sccache should be checked.

pyranota commented 1 week ago

btw did you mean sccache and not sscache?

rubenfiszel commented 1 week ago

Yes I mean sccache.

The reason I thought sccache was useful is in the case where the imports are the same and you did a minor change in your main function. Yes you will need to recompile main but not the imports (but that I'm not sure)

pyranota commented 1 week ago

Unless these imports are using generics or input data changed (e.g. env variable used to compile subcrate), rust will skip recompilation of those by default. sccache is usually useful only on clean builds. Where rust is smart enough to skip rebuilding same artifacts. If something recompiling, than its more likely that the produced artifact will be different, thus sccache can not provide needed cache.

pyranota commented 1 week ago

It is still useful to have sccache for cold starts

rubenfiszel commented 1 week ago

@pyranota I think you're forgetting that in Windmill, every job has an ephemeral folder and the target of cargo is part of that. So unless I'm mistaken, because the target is deleted after the job, for every job it needs to recompile from start because lack of target folder. sccache primary purpose would be to cache globally those.