-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking issue: compile times #1303
Comments
I did some investigations. (On c82a279). Running
It's pretty clear from this, that the code generation phase takes by far the longest. Here I used the default linker it seems (why is my mold config gone... oh well). These phases take so long because rustc is likely emitting tons of LLVM code. This is unfortunately also a well known problem (thanks to proc macros and monomorphization). It's not impossible to improve the situation, however! Here is the flame graph for the same data: Running
Independent of all that, I tried disabling mod build_info {
// include!(concat!(env!("OUT_DIR"), "/built.rs"));
pub const PKG_VERSION: &str = "2.12";
pub const BUILT_TIME_UTC: &str = "now";
pub const GIT_COMMIT_HASH: Option<&str> = Some("123");
pub const GIT_DIRTY: Option<bool> = Some(false);
pub const TARGET: &str = "beteradf";
} And it reduced build times from 16.5s to 16s. Which isn't a lot relatively speaking, but if we manage to reduce the build times drastically by some other way, it's worth remembering these 500ms we can maybe shave off. I will however, not actually spend any time now trying to improve the situation. I just wanted to write down my observations. |
The incremental compile times for the Tobira backend have gotten quite annoying.
touch src/api/id.rs && cargo build
takes roughly 16s for me, which is not great. And I have a Ryzen 7 7700X which is quite modern, especially regarding single core performance, which is most relevant for incremental compile times.The full compile time (including all dependencies) with 51s isn't that bad, that's quite acceptable. But yeah the incremental compile time really makes development ... uhg.
This issue is just here to collect information on the issue and potentially track progress (or lack thereof...).
Unfortunately, it's not too surprising that Tobira takes a while to compile. We use lots of procedural macro helpers (
confique
for configuration,juniper
for the GraphQL API,serde
for various (de)serializations,clap
for CLI args,reinda
for assets, ...). I don't want to shit on proc-macros, I do like the tool, but they have to be expanded and, likely more importantly, they can quickly generate quite a lot of code that rustc then has to churn through.Some resources:
The text was updated successfully, but these errors were encountered: