-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
Is sccache
applicable/useful for evcxr
due the cdylib
crate type?
#184
Comments
The cdylib is the final target that gets built, but I would assume rlibs get produced for all the crates that get linked together to produce that cdylib. I just did a test compiling the regex crate and did see a speedup on subsequent runs. My methodology was as follows:
I did this 3 times with sccache disabled and 3 times with it enabled and discarded the first run of each. With sccache disabled, I got 12128ms and 12169ms. With sccache enabled, I got 3474ms and 4139ms. |
One thing you could try would be to make a dylib containing all dependencies. You can then depend on this dylib from all compiled user code dylibs. This should save linking time and memory. |
Note that dependencies are not loaded by rustc unless you reference them. |
@davidlattimore I did the same experiment that you did and you are right. I got between 52 and 59 secs without the cache and around 9 secs with the cache enabled. So Let me explain what I tested:
I repeated the test a few times with From that I deduce that And the My intuition says that most of the time is spent in I think that In particular:
I could do a proof of concept and get concrete numbers and if they are good, would the project willing to accept such feature (cache dynamic libraries)? |
Does using lld as linker help? |
I don't know, but I would guess that the time writing to disk + running the compilation (running Having said that, But I'm just speculating here. |
For me linking takes more than half the time of compiling hello world with rustc. Same for compiling a dynamic library with |
@bjorn3 I did a quick test and I'm having the same results. Using I executed |
I'm happy to accept a PR, if this is something you'd like to work on. Probably any such cache should be behind a config option that's off by default, since otherwise the disk usage might surprise people, and running the same commands repeatedly is unlikely to be a super-common use-case, so people can probably turn it on if they find they need it. |
Yes, I agree that this should be optional and turned off by default. I will code a proof of concept in these days and see how far we can go. TL;DRMy use-case is to use Theses Rust examples contain not only the code but also the expected output. Then Basically it turns a documentation in a regression test suite and in this scenario executing the same Rust snippet is the most common case. |
Summary
sccache
doesn't supportcdylib
crate types soevcxr
cannot get any speed up from using it.If that is correct,
evcxr
about thissccache
limitation?evcxr
like caching the.so
files generated (I will like to here comments about this)Long story
I installed
sccache
and whileevcxr
seems to send the requests to it,sccache
keeps saying the it cannot cache them.After a few try-and-error experimentation, I found that changing the crate type generated by
evcxr
fromcdylib
torlib
and disabling the incremental building are the requirements forsccache
to start working (but I'm not claiming that this can be of any usefulness forevcxr
)A comment in the
sccache
code suggests thatcdylib
is not supported at all:https://github.com/mozilla/sccache/blob/3f318a8675e4c3de4f5e8ab2d086189f2ae5f5cf/src/compiler/rust.rs#L1057-L1058
The text was updated successfully, but these errors were encountered: