Skip to content
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

Improve -Zmeta-stats some more #102041

Merged
merged 2 commits into from
Sep 21, 2022
Merged

Conversation

nnethercote
Copy link
Contributor

A follow-up to #97384.

r? @bjorn3

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 20, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 20, 2022
@nnethercote
Copy link
Contributor Author

Best reviewed one commit at a time. The first commit is stolen from #101014, and we should probably let that PR merge before this one.

@bjorn3
Copy link
Member

bjorn3 commented Sep 20, 2022

r=me once #101014 lands.

@nnethercote
Copy link
Contributor Author

I forgot to show the before:

1268465 metadata bytes, of which 0 bytes (0.0%) are zero
             preamble:       30 bytes ( 0.0%)
                  dep:      923 bytes ( 0.1%)
          lib feature:        0 bytes ( 0.0%)
stability_implications:        0 bytes ( 0.0%)
            lang item:        0 bytes ( 0.0%)
      diagnostic item:        0 bytes ( 0.0%)
           native lib:        0 bytes ( 0.0%)
      foreign modules:        0 bytes ( 0.0%)
       def-path table:    33048 bytes ( 2.6%)
               traits:        8 bytes ( 0.0%)
                impls:     2538 bytes ( 0.2%)
     incoherent_impls:        0 bytes ( 0.0%)
                  mir:    18105 bytes ( 1.4%)
                 item:   442248 bytes (34.9%)
interpret_alloc_index:        0 bytes ( 0.0%)
      proc-macro-data:        0 bytes ( 0.0%)
               tables:   557422 bytes (43.9%)
 debugger visualizers:        0 bytes ( 0.0%)
     exported symbols:        0 bytes ( 0.0%)
              hygiene:    27103 bytes ( 2.1%)
      def-path hashes:   172083 bytes (13.6%)
           source_map:    14621 bytes ( 1.2%)
                final:      336 bytes ( 0.0%)

and after

meta-stats METADATA STATS
meta-stats Section                      Size
meta-stats ----------------------------------------------------------------
meta-stats lib-features                    0 ( 0.0%)
meta-stats stability_implications          0 ( 0.0%)
meta-stats lang-items                      0 ( 0.0%)
meta-stats diagnostic-items                0 ( 0.0%)
meta-stats native-libs                     0 ( 0.0%)
meta-stats foreign-modules                 0 ( 0.0%)
meta-stats incoherent-impls                0 ( 0.0%)
meta-stats interpret-alloc-index           0 ( 0.0%)
meta-stats proc-macro-data                 0 ( 0.0%)
meta-stats debugger-visualizers            0 ( 0.0%)
meta-stats exported-symbols                0 ( 0.0%)
meta-stats traits                          8 ( 0.0%)
meta-stats preamble                       30 ( 0.0%)
meta-stats final                         335 ( 0.0%)
meta-stats dep                           923 ( 0.1%)
meta-stats impls                       2_538 ( 0.2%)
meta-stats source-map                 14_623 ( 1.2%)
meta-stats mir                        18_105 ( 1.4%)
meta-stats hygiene                    27_103 ( 2.1%)
meta-stats def-path-table             33_048 ( 2.6%)
meta-stats def-path-hash-map         172_083 (13.6%)
meta-stats items                     442_248 (34.9%)
meta-stats tables                    557_422 (43.9%)
meta-stats ----------------------------------------------------------------
meta-stats Total                   1_268_466 (of which 47.4% are zero bytes)
meta-stats

@nnethercote
Copy link
Contributor Author

#101014 has been merged.

@bors r=bjorn3

@bors
Copy link
Contributor

bors commented Sep 20, 2022

📌 Commit fcbc70cdb5d25d9f653edd35e7950acc8a869e81 has been approved by bjorn3

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 20, 2022
@nnethercote
Copy link
Contributor Author

@bors rollup=always

It's now much more like the `-Zhir-stats` output.
- Each line is preceded with `meta-stats`, which makes the provenance
  clearer and allows filtering of the output.
- Sections are now sorted in reverse order of size.
- Column headings avoid the need to repeat the word "bytes" on every line.
- Long numbers now have `_` separators for easier reading.
- Consistent use of '-' within section labels, rather than a mix of '-',
  '_', and ' '.

The code itself is shorter and easier to read thanks to:
- the `stat` macro, which encapsulates each section's encoding, avoids
  some boilerplate, and removes the need for some low-value comments;
- the `stats` vector, which replaces dozens of local variables.
@nnethercote
Copy link
Contributor Author

@bors r=bjorn3

@bors
Copy link
Contributor

bors commented Sep 21, 2022

📌 Commit a7b35b5 has been approved by bjorn3

It is now in the queue for this repository.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 21, 2022
…bjorn3

Improve `-Zmeta-stats` some more

A follow-up to rust-lang#97384.

r? `@bjorn3`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Sep 21, 2022
…bjorn3

Improve `-Zmeta-stats` some more

A follow-up to rust-lang#97384.

r? ``@bjorn3``
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 21, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#89891 (`alloc`: add unstable cfg features `no_rc` and `no_sync`)
 - rust-lang#101995 (Add another example for `uN::carrying_mul`)
 - rust-lang#102031 (Adding ignore fuchsia tests for Backtrace, ErrorKind cases)
 - rust-lang#102041 (Improve `-Zmeta-stats` some more)
 - rust-lang#102045 (fix ConstProp handling of written_only_inside_own_block_locals)
 - rust-lang#102058 (Clarify Path::extension() semantics in docs abstract)
 - rust-lang#102059 (Use rebind instead of dummy binder in `SameTypeModuloInfer` relation)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4b7c596 into rust-lang:master Sep 21, 2022
@rustbot rustbot added this to the 1.66.0 milestone Sep 21, 2022
@nnethercote nnethercote deleted the improve-meta-stats branch September 24, 2022 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants