-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Start improving monomorphization items stats #105481
Conversation
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki |
Outputting as markdown doesn't seem very extensible, it's hard to parse. Could we output JSON instead (and document a simple JQ command to turn it into markdown)? |
Let csv win in that case. |
@jyn514 Do you have use cases in mind where you'd want to parse the output? |
@wesleywiser if print-mono-items were extensible / used JSON, we could have added to that flag instead of adding a new one. I don't have concrete use cases in mind, but it seems nice to make the output reusable instead of hardcoding markdown. |
This option will output some stats from the monomorphization collection pass to a file, to show estimated sizes from each instantiation.
You could add the same information to @wesleywiser what do you want to do here ? |
Ok, makes sense. I don't have strong objections to markdown. |
I used this a bit yesterday to look at some codesize issues and found the current format helpful as it was easy to just set @bors r+ |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#105481 (Start improving monomorphization items stats) - rust-lang#105674 (Point at method chains on `E0271` errors) - rust-lang#105679 (Suggest constraining type parameter with `Clone`) - rust-lang#105694 (Don't create dummy if val has escaping bounds var) - rust-lang#105727 (Tweak output for bare `dyn Trait` in arguments) - rust-lang#105739 (Migrate Jump to def links background to CSS variable) - rust-lang#105743 (`SimplifiedType` cleanups) - rust-lang#105758 (Move `TypeckResults` to separate module) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
How does everyone view markdown files? BTW, I was a little surprised that the markdown files ended up in the root directory. I went looking in the build directory first, where things like |
@nnethercote you can use pulldown-cmark to convert them to html and view them in a browser, or paste them into a gist and have GitHub render them. |
@nnethercote btw, similarly to -Zself-profiler, you can also pass a directory as the flag’s parameter and it’ll dump files there instead of the current directory. Some editors also support markdown rendering, either natively or via plugins, VSCode for example, and I often use that or hackmd. |
Add JSON output to -Zdump-mono-stats Follow-up to rust-lang#105481 r? `@lqd` cc `@wesleywiser`
As described in this zulip discussion, some stats about monomorphization collection would be interesting to have, in a different form than
-Zprint-mono-items
: to have some visibility into the cost of the mono items, we'd like to know how many are instantiated and what is their estimated size.That can be a proxy to analyze sources of slow compile times, although in the future, we'd also like to add more realistic stats from the actual backend's lowering.
This PR adds a new
-Z dump-mono-stats
flag which will output some stats in a{crate_name}.mono-items.md
file (the flag optionally takes an output directory parameter, for easier use within a workspace than printing to stdout).For example,
will output a file with this markdown table (abridged for readability), for a debug build:
Click for full output
Since we discussed it together, r? @wesleywiser.