Skip to content

Add -Zcache-proc-macros flag to config_fast_builds.toml#24595

Open
perry-blueberry wants to merge 1 commit into
bevyengine:mainfrom
perry-blueberry:cache-proc-macro-flag
Open

Add -Zcache-proc-macros flag to config_fast_builds.toml#24595
perry-blueberry wants to merge 1 commit into
bevyengine:mainfrom
perry-blueberry:cache-proc-macro-flag

Conversation

@perry-blueberry

Copy link
Copy Markdown

Objective

Add flag to improve incremental build times.

Solution

Add the flag -Zcache-proc-macros to config_fast_build_times.config so that a user can easily enable it if they want to.

Testing

I did a few tests back and forth with and without this on Linux. I saw consistent incremental build time gains, maybe around 5%. I've also been running with this on aarch64 Mac so it compiles there as well. I haven't tested this on Windows.

I unfortunately did not save the run results I gathered.


Another thing to note is that this might slightly increase clean compilation times but only by a small fraction (maybe a couple of percent, not sure). I'm guessing this might be a hot path in the compiler so branching on this condition every time could possibly make it slightly slower? Or it might have just been noise.

The claim that it improves incremental by 5-10% is based on my own experiments and the original rust PR that states

On a no-op change re-check of octocrab 0.49 (which has a ton of serde derive proc macro invocations), this saves ~0.6s out of ~6s (so a ~10% win) on my PC.

Maybe we shouldn't give a number at all? It might even be the case that a user doesn't notice this a lot of the time. My suspicion is that this would make more of a difference if a crate has many and large derive macros, relative to the rest of the code size.

Also I asked about this in the Discord server, but this will probably return stale results if a proc macro if there are side effects. Does Bevy have any side effects in proc macros?

@github-actions

Copy link
Copy Markdown
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨

@perry-blueberry

perry-blueberry commented Jun 11, 2026

Copy link
Copy Markdown
Author

What the hell, I was creating this on my GF's laptop (Macbooks are really nice for incremental compilation!) and it somehow linked to her account. Well that's a bit embarrassing 😅 I guess she won't mind though 😆

Edit: Well not so weird now that I think about it. I only added SSH keys and not my own user. Anyway it's bit funnier this way lol

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.

3 participants