New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust-Script caching does not work #968
Comments
@mbfm previously i used a different (unmaintained now) crate which i think hashed the code and cache was based on that so caching worked. seems the alternatives i used do not do that. |
@mbfm can you check the dev branch 0.37.3 and verify this is now working as expected (faster)? |
@mbfm this is now officially released |
Awesome, thanks. Anecdotally, cached execution time for one of our somewhat more complex flows (runs 4 Rust scripts) dropped from 50 seconds to less than 5 seconds. |
@mbfm thanks for checking |
Describe The Bug
The built-in caching of rust-script does not seem to work when executed from cargo-make. This means for each execution of a Rust-scripted cargo-make task, the Rust code always needs to be re-compiled. This leads to a major increase in execution times, especially with multiple Rust-scripted tasks and when using dependencies in them.
My assumption is that this is caused by cargo-make placing each Rust snippet into a randomized path before passing it to rust-script (e.g.
/tmp/fsio_EZBn6pD1kk.rs
). Due to the file names always changing, the caching mechanism of rust-script is effectively bypassed.This also leads to an enormous amount of cached builds being stored by rust-script underneath
~/.cache/rust-script/binaries/
(currently at 245 GB on my dev laptop).To Reproduce
Use e.g. this task definition:
Then run this task two or more times. Due to the dependency, compiling takes a noticeable amount of time. The
println!()
indicates when compiling is finished, and it shows that each time, the actual executable is different (i.e. not re-using a cached executable).The text was updated successfully, but these errors were encountered: