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

Build still takes a long time even with sccache #814

Closed
Timmmm opened this issue Jul 22, 2020 · 5 comments
Closed

Build still takes a long time even with sccache #814

Timmmm opened this issue Jul 22, 2020 · 5 comments

Comments

@Timmmm
Copy link
Contributor

Timmmm commented Jul 22, 2020

I have a program that takes about 1 minute to build. With sccache it still takes around 40 seconds even if I don't change anything. Is that expected? Here is the timing report, clean and then cached. It does seem to cache a lot of things, but not serde-regex, or two of my crates (file-loaders and backend).

empty_cache
full_cache

I filtered out <1.5s crates in the first one and and <1s in the second.

Here are the stats after one cached build:

$ sccache --show-stats
Compile requests                    357
Compile requests executed           244
Cache hits                           67
Cache hits (Rust)                    67
Cache misses                        177
Cache misses (Rust)                 177
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                 113
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.000 s
Average cache read miss           1.324 s
Average cache read hit            0.019 s
Failed distributed compilations       0

Non-cacheable reasons:
crate-type                          102
-                                     7
incremental                           4

Cache location                  Local disk: "/Users/timh/Library/Caches/Mozilla.sccache"
Cache size                          112 MiB
Max cache size                       10 GiB

This is all in debug mode. Weirdly, in release mode file_loaders does get cached:

release_cached

How can I figure out why these crates aren't being cached? Is there some kind of log file?

@Timmmm
Copy link
Contributor Author

Timmmm commented Jul 22, 2020

Ah I found the logging options in the readme, and with RUST_LOG=debug it tells me this for file_loaders in debug mode:

DEBUG 2020-07-22T12:01:18Z: sccache::server: parse_arguments: CannotCache(incremental): ["--crate-name", "file_loaders", "--edition=2018" ...

backend cannot be cached because it is a bin crate, and serde_derive can't be cached because it is a proc macro. That sucks. :-/

@froydnj
Copy link
Contributor

froydnj commented Jul 30, 2020

Ah I found the logging options in the readme, and with RUST_LOG=debug it tells me this for file_loaders in debug mode:

DEBUG 2020-07-22T12:01:18Z: sccache::server: parse_arguments: CannotCache(incremental): ["--crate-name", "file_loaders", "--edition=2018" ...

backend cannot be cached because it is a bin crate, and serde_derive can't be cached because it is a proc macro. That sucks. :-/

It does. :( It's possible we could give sccache some deep knowledge of how things were linked and speed things up (after all, you are probably compiling with the same toolchain all the time), but I think that might be more complexity than it's worth.

I do like the graphs, though; what did you use to generate them?

@froydnj froydnj closed this as completed Jul 30, 2020
@luser
Copy link
Contributor

luser commented Jul 30, 2020

It does. :( It's possible we could give sccache some deep knowledge of how things were linked and speed things up (after all, you are probably compiling with the same toolchain all the time), but I think that might be more complexity than it's worth.

There's a proposed Rust feature that could make this better.

@Timmmm
Copy link
Contributor Author

Timmmm commented Jul 31, 2020

I do like the graphs, though; what did you use to generate them?

You just run cargo build -Z timings (I can't remember but it might need nightly) and it generates an html file.

@Timmmm
Copy link
Contributor Author

Timmmm commented Jul 31, 2020

By the way, regarding the system linker, would it help if Rust used LLVM's LLD linker?

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

3 participants