Skip to content
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

[feature request] sccache compatibility #46

Closed
swfsql opened this issue Apr 13, 2019 · 1 comment
Closed

[feature request] sccache compatibility #46

swfsql opened this issue Apr 13, 2019 · 1 comment

Comments

@swfsql
Copy link

swfsql commented Apr 13, 2019

Hello, first I'd like to thank you for this project!


This issue is a feature request that would make the usages of cargo commands compatible with the sccache (caching for compilation).

I'm using your rust integration for jupyter labs, and I have confirmed that after installing https://github.com/mozilla/sccache (via cargo install sccache) and setting export RUSTC_WRAPPER=sccache before starting jupyter, the compilation calls indeed are sent to sccache - but for some reason they can't be cached - observed via watch sccache --show-stats.

I think the kernel restarting should not be a problem for sccache, since cargo clean on normal projects still benefit from sccache, and also regarding normal projects, different projects (different name on different paths) also benefit from the caching of external libraries from other projects.

I also tried manually running cargo rustc -- -C prefer-dynamic --error-format json on /tmp/.tmpza75ej/evcxr_meta_module and also on other user_code_x directories and they appear to use scchache correctly.

But somehow, when jupyter asks for it's execution, they fall as "Non-cacheable calls" on the sccache stats and thus are never cached. I don't know what is causing this behaviour.

Here's a rust-specific info from sccache: https://github.com/mozilla/sccache/blob/master/docs/Rust.md
If you'd like more info, please let me know!

I think compilation caching could be very welcome for the rust+jupyter use-case, since the initial compilation duration is quite apparent whenever a couple of crates are used.
Since the same target directory is being used for every cell from the same notebook, there is already some standard caching. But if evcxr were compatible with scchache, I think it'd be a boost for first-runs and also for the multi-notebook case.

@davidlattimore
Copy link
Collaborator

Thanks for the excellent suggestion. Sorry it took me a while to get to it. Looks like the issue was that evcxr was setting CARGO_TARGET_DIR. Fortunately, I recently switched evcxr from a crate per eval to a single crate, which made setting CARGO_TARGET_DIR unnecessary.

I've also added explicit integration, which I figured might be easier than having to set the environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants