3 ms·
Reading the article.made me realize that we could do something that might or might not be a net positive: we can assume that proc macros are idempotent and imme
by estebank 3y ago
Reading the article.made me realize that we could do something that might or might not be a net positive: we can assume that proc macros are idempotent and immediately use the cached version while still performing the compilation and expansion as we do now. If the result of the new run matches, then we mark the macro as "likely idempotent". If not, we mark it to never attempt to cache that macro for that crate version ever again (globally in a devs machine, even!) and invalidate all of the unitd that assumed idempotency. This would pessimize the incr comp performance for the first compilation the "optimization" fails, but would allow all other cases to compuke faster (with no resource utilization improvements). This approach doesn't require people to annotate their crates in any way. As an improvement on this approach we can add annotations for known non-idempotent crates to not bother with this new behaviour. All of this would get around the issue of "what if a crate is incorrectly marked as idempotent?".