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

Speed up compiles and clean up RUSTFLAGS #45

Merged
merged 1 commit into from
Dec 3, 2024
Merged

Conversation

swenson
Copy link
Collaborator

@swenson swenson commented Dec 3, 2024

Before:

cargo t  14.69s user 7.03s system 161% cpu 13.420 total

After:

cargo t  12.20s user 5.38s system 182% cpu 9.612 total

We consolidate RUSTFLAGS so that they are entirely in .cargo/config.toml -- this speeds up compiles since we aren't modifying RUSTFLAGS as part of cargo xtask *-build (which triggers recompiles). This also means we only need to worry about the flags in .cargo/config.toml.

Putting all of the RUSTFLAGS in .cargo/config.toml is mostly equivalent to passing them as an environment variable: there was a 100 byte difference in the application build, but it's not clear why.

We also add a filesystem cache of the result of finding the sysroot. For some reason, repeated calculation of it can be expensive (adds multiple seconds to the build).

Fixes #39

Before:

```
cargo t  14.69s user 7.03s system 161% cpu 13.420 total
```

After:

```
cargo t  12.20s user 5.38s system 182% cpu 9.612 total
```

We consolidate RUSTFLAGS so that they are entirely in
`.cargo/config.toml` -- this speeds up compiles since we aren't
modifying `RUSTFLAGS` as part of `cargo xtask *-build` (which triggers
recompiles). This also means we only need to worry about the flags in
`.cargo/config.toml`.

Putting all of the `RUSTFLAGS` in `.cargo/config.toml` is mostly
equivalent to passing them as an environment variable: there was a 100
byte difference in the application build, but it's not clear why.

We also add a filesystem cache of the result of finding the `sysroot`.
For some reason, repeated calculation of it can be expensive (adds multiple
seconds to the build).

Fixes #39
Copy link
Collaborator

@mlvisaya mlvisaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@swenson
Copy link
Collaborator Author

swenson commented Dec 3, 2024

Thanks!

@swenson swenson merged commit 638ffba into main Dec 3, 2024
1 check passed
@swenson swenson deleted the speed-up-compiles branch December 3, 2024 21:31
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

Successfully merging this pull request may close these issues.

Compiles are too slow
2 participants