Interesting Compile time benchmark for proc-macro with syn Vs w/o syn
⚓ Rust 📅 2026-03-21 👤 surdeus 👁️ 2I have a proc-macro based error-handling crate similar to thiserror and anyhow called ResExt, I used to use syn for enum parsing, but now, I removed syn from deps and refactored to manually parse TokenStream.
I benchmarked compilation speed which was the main motivation of the refactor, and it's indeed faster, but cargo clippy is ~1.1x slower.
This wouldn't matter for my crate at all and it wouldn't matter for proc-macro users in general, but for CI systems and especially for larger proc-macros, this would matter, any idea why this happened? I benchmarked using hyperfine the before and after using this command:
hyperfine --prepare "cargo clean" \
"cargo clippy" \
--cleanup "sed -i 's/resext-macro = \"1.3.3\"/resext-macro = { path = \"..\/resext-macro\" }/' resext/Cargo.toml" \
"cargo clippy"
repo structure:
ResExt/
|
|_ resext/ -> Main crate
|
\_ resext-macro/ -> proc-macro crate
1 post - 1 participant
🏷️ Rust_feed