12% speed-up to vector incremental builds #19930
kapilsinha
started this conversation in
General
Replies: 1 comment 2 replies
-
Thanks for sharing @kapilsinha ! That is interesting and quite the improvement. I don't think we'd want to run a remote build tool though, do you have any plans to upstream these changes to Rust? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
12% speed-up to vector.dev incremental builds
Summary
I have forked & modified the Rust compiler, achieving 12% faster incremental builds for vector.dev. The modded compiler can cache proc macro expansion; as you know, heavy proc macro dependencies impact compilation time and cause lags in rust-analyzer (in VSCode). vector.dev depends on proc-macro heavy crates like async-graphql, and thus benefits from this optimization. I have profiled vector's incremental builds, and have found that with zero configuration I achieve 12% faster builds (via cargo check):
More details
I learned that the Rust compiler re-expands every macro in a crate, even on one-line edits, which is a disaster for the edit-compile-run cycle. Taking a similar approach to Rust's incremental compilation, I modified the Rust compiler to cache these expansions (in particular, the ones without side-effects; the
counter!
macros in vector.dev are the only ones that have side-effects) so that we don't need to re-compute them when unrelated code changes. This proc macro cache is the first tool in a toolkit that I am building -- all with the goal of improving Rust developer productivity!Chat?
I'd love to chat and/or have you try it out! I've recently packaged it into a remote build tool, which allows you to try it out in <3 minutes.
Beta Was this translation helpful? Give feedback.
All reactions