Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/rust
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: rust-lang/rust
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: automation/bors/try-merge
Choose a head ref
  • 4 commits
  • 2 files changed
  • 2 contributors

Commits on Jun 25, 2025

  1. Configuration menu
    Copy the full SHA
    04ff853 View commit details
    Browse the repository at this point in the history

Commits on Jun 26, 2025

  1. Configuration menu
    Copy the full SHA
    e8fc30e View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2025

  1. Use portable AtomicU64

    Kobzol committed Jul 2, 2025
    Configuration menu
    Copy the full SHA
    b49ca02 View commit details
    Browse the repository at this point in the history
  2. Auto merge of #142978 - Kobzol:query-hit, r=<try>

    Add new self-profiling event to cheaply aggregate query cache hit counts
    
    Self-profile can record various types of things, some of them are not enabled, like query cache hits. Rustc currently records cache hits as "instant" measureme events, which records the thread ID, current timestamp, and constructs an individual event for each such cache hit. This is incredibly expensive, in a small hello world benchmark that just depends on serde, it makes compilation with nightly go from ~3s (with `-Zself-profile`) to ~15s (with `-Zself-profile -Zself-profile-events=default,query-cache-hit`).
    
    We'd like to add query cache hits to rustc-perf (rust-lang/rustc-perf#2168), but there we only need the actualy cache hit counts, not the timestamp/thread ID metadata associated with it.
    
    This PR adds a new `query-cache-hit-count` event. Instead of generating individual instant events, it simply aggregates cache hit counts per *query invocation* (so a combination of a query and its arguments, if I understand it correctly) using an atomic counter. At the end of the compilation session, these counts are then dumped to the self-profile log using integer events (in a similar fashion as how we record artifact sizes). I suppose that we could dedup the query invocations in rustc directly, but I don't think it's really required. In local experiments with the hello world + serde case, the query invocation records generated ~30 KiB more data in the self-profile, which was ~10% increase in this case.
    
    With this PR, the overhead of `-Zself-profile` seems to be the same as before, at least on my machine, so I also enabled query cache hit counts by default when self profiling is enabled.
    
    We should also modify `analyzeme`, specifically [this](https://github.com/rust-lang/measureme/blob/master/analyzeme/src/analysis.rs#L139), and make it load the integer events with query cache hit counts. I can do that as a follow-up, it's not required to be done in sync with this PR, and it doesn't require changes in rustc.
    
    CC `@cjgillot`
    
    r? `@oli-obk`
    try-job: dist-powerpc-linux
    rust-bors[bot] authored Jul 2, 2025
    Configuration menu
    Copy the full SHA
    fc33cd0 View commit details
    Browse the repository at this point in the history
Loading