News for hackers. Stuff that matters.
Re:I reduced (incremental) Rust compile times by up to 40% by kapilsinha on Monday March 18, 2024 @08:32AM (#39743432)
Hi HN, I’m Kapil from CodeRemote. I am building Rust developer productivity tooling to speed up your edit-compile-run cycle. While I love Rust for its runtime performance and safety (not to mention its sweet syntactic sugar), I have long been frustrated with the resultant compile times.

This frustration hit a tipping point a few months ago, as I was building on a sluggish framework that made heavy use of code generation. From the Rust/Cargo/Rustc books and Rust community’s blog posts, I picked up and applied most of the standard tricks to speed up builds — but with only marginal improvement. Continued frustration led to me profiling and analyzing compile times, and soon I landed at the Rustc (compiler) source code…

I modified the compiler and implemented procedural macro caching, which has considerably sped up incremental builds for projects with macro-heavy dependencies. My fork of the compiler is still private as I’m still thinking through the licensing model; but if you’re interested in trying it out, please hit the “sign up” at the bottom of the blog. I am packaging it into a build/development server for a few Rust dev teams, and have already shared it with a few self-hosters! In this blog post, I discuss in detail my macro caching implementation and results. I’d love to hear your thoughts, and I’m happy to talk further about my compiler modifications.

There are no comments on this comment yet.