-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Fix performance regression from #89695 #89732
Comments
From https://perf.rust-lang.org/compare.html?start=6928fafe06e4ab29317f75194e1bf67c119dccdc&end=c1cb97481a633bdfdf3d6b57c6dcebfdfadbcfdf (linked by @rust-timer in #89695 (comment)), it looks like these are the most-affected doc builds:
How can I find the commands I should run to reproduce these builds? In particular I'd like to try and reproduce the externs-doc build since that's most affected. I'd also appreciate any pointers on differential profiling so I can narrow in on the differences. |
https://github.com/rust-lang/rustc-perf/tree/master/collector has instructions how to run them locally |
Thanks! I've cloned that repo and got it working, but I can't find any mention of externs-doc in it. Where would I find details of how externs-doc is run? |
"externs-doc" means: benchmark running rustdoc on the externs crate. Select the crate with |
Thanks to tips in #87244 (comment), I've run a profile comparison with cachegrind:comparison.txt Some highlights:
Some interesting things that seems to point to are use of regex in Tera (used to process dotted field names, like component.path) and building of BTrees. BTree is used when building a tera::Context, which is the mapping from field names to field values. We do this on each render, with substantively the same tree structure. We might be able to speed things up by reusing the same Context and inserting different data into it. There is also a lot of malloc and free going on. The Tera API inherently involves a lot of Strings, because it doesn't take ownership of its inputs, so it has to copy them into Strings (or other owned types). |
rustc is compiled with jemalloc in linux release builds, does that also apply to rustdoc? If so you have to manually enable that in your config toml to get comparable results. |
Good tip, thanks! Here's what it looks like after setting
|
Is the ordering essential to all use-cases? Maybe the option to use a hashmap instead of a tree map could speed it up. |
It was fixed in #92526 when we switched to askama. |
In #89695, we extended the usage of tera. However, it impacted the doc build time badly, so we need to fix it.
cc @jsha
The text was updated successfully, but these errors were encountered: