-
Notifications
You must be signed in to change notification settings - Fork 493
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
Optimizing docs generation #420
Comments
Thanks! |
I can't build the docs on linux:
I'd be interested how long rustdoc takes to run after you add
and then upload |
Hey @jyn514 thanks for the help! @rylev may have some tips for how to build on Linux - I have no idea. Note that you need to build a separate repo. The docs are too huge that I didn't want to include them inside the
This takes about 30 minutes and 20GB of memory. I updated the lib.rs file to look like this: #![doc(html_no_source)]
::windows::include_bindings!(); Note that
It took about 52 mins and it's peak working set (memory) is over 21GB. I could not find a |
Hmm, it should be there somewhere - do you see any file ending in .mm_profdata? It may be in the workspaces root, not the directory you ran cargo in. If not, what version of rustdoc are you using? I think the format of the self-profile files changed a few months ago. |
|
Oh shoot, I'm sorry, it should have been -Z self-profile, not -Z time-passes. It's ok, time-passes gave some useful info too. In particular it shows most of the time is spent on get_blanket_impls, which I've been meaning to improve for a while. It doesn't show where the memory usage is coming from, though, it already uses 18 GB before looking at impls. You posted the default version of rustdoc - can you post the nightly version instead? |
OK, I'll rerun with |
Not sure if it will work, but I've uploaded to OneDrive. Let me know if you can download it. |
That worked, thanks! Downloading it now, I'll let you know what I find :) |
By the way, you can analyze it yourself with measureme: https://github.com/rust-lang/measureme/ |
The Rust compiler certainly has a lot of trouble with the resulting 300M |
For those following along at home, the summarize summary can be seen here. |
I have applied the html_no_source update - thanks for the suggestion! GitHub no longer refuses to accept some of the files but continues to warn about the huge search-index.js file:
The size of this file also seems to hurt page load and search performance in the browser. |
Yeah, it's a known issue: rust-lang/rust#31387. I'll look into it after fixing rust-lang/rust#81251. |
Thanks again for all your help. |
FYI, what we've found is that the actual CPU time is not all that high (comparable to e.g. docs.rs), the problem is that compiling shoots up to 20 GB of memory usage which sets almost everyone's computer thrashing. @rylev compiled this on a computer with more than that amount of memory and it took about 2.5 minutes. https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf/near/223954279 |
Was that on a Windows box? IO performance is very different between Windows and Linux. My dev box has 32GB of memory and it took around 30 minutes without much disk thrashing. It was definitely CPU bound and largely chugging away on a single thread. But maybe I missed something. |
Oh, that's really strange. Maybe @rylev measured the wrong thing? It definitely took him no more than 3 minutes: |
Sorry, I should have made this more clear to @jyn514 that I was testing a subset of the full windows API surface. So it's perfectly conceivable that it would take ~30 minutes on my machine as well. I also have 32 GB of RAM. |
FYI: The changes I made in rust-lang/rust#81419 and rust-lang/rust#81414 reduce |
If anyone is interested what the timings look like for a smaller subset of the bindings, here they are. |
That's fantastic. Looks like some more low-hanging fruit... 😄 |
Turns out its much slower than I first imagined. I was looking at the summary time reported by Also take a look at how much memory its using. |
I've done all I can to optimize this from my end. Going to close this issue unless someone has a reason to keep it open. |
Hmm, I don't know if anyone has permissions to transfer this from |
I've asked someone at GitHub to take a look. |
Unfortunately, GitHub doesn't support this. Happy to leave the issue open if you'd prefer. |
Yes, you can transfer within an organization - I do that regularly - but you cannot do so across organizations (at least according to my GitHub contact). |
I had brought up the size of the generated rustdoc for windows-rs on the Rust Community Discord and rustdoc team member @jyn514 mentioned that adding the
#![doc(html_no_source)]
to the crate should suppress the HTML rendering of the crate source.https://doc.rust-lang.org/stable/rustdoc/the-doc-attribute.html#html_no_source
The text was updated successfully, but these errors were encountered: