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

Replace a number of FxHashMaps/Sets with stable-iteration-order alternatives #119192

Merged
merged 14 commits into from
Jan 5, 2024

Conversation

michaelwoerister
Copy link
Member

This PR replaces almost all of the remaining FxHashMaps in query results with either FxIndexMap or UnordMap. The only case that is missing is the EffectiveVisibilities struct which turned out to not be straightforward to transform. Once that is done too, we can remove the HashStable implementation from HashMap.

The first commit adds the StableCompare trait which is a companion trait to StableOrd. Some types like Symbol can be compared in a cross-session stable way, but their Ord implementation is not stable. In such cases, a StableCompare implementation can be provided to offer a lightweight way for stable sorting. The more heavyweight option is to sort via ToStableHashKey, but then sorting needs to have access to a stable hashing context and ToStableHashKey can also be expensive as in the case of Symbol where it has to allocate a String.

The rest of the commits are rather mechanical and don't overlap, so they are best reviewed individually.

Part of MCP 533.

@rustbot
Copy link
Collaborator

rustbot commented Dec 21, 2023

r? @TaKO8Ki

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 21, 2023
@michaelwoerister
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 21, 2023
@bors
Copy link
Contributor

bors commented Dec 21, 2023

⌛ Trying commit 178b813 with merge 28f9060...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 21, 2023
Replace a number of FxHashMaps/Sets with stable-iteration-order alternatives

This PR replaces almost all of the remaining `FxHashMap`s in query results with either `FxIndexMap` or `UnordMap`. The only case that is missing is the `EffectiveVisibilities` struct which turned out to not be straightforward to transform. Once that is done too, we can remove the `HashStable` implementation from `HashMap`.

The first commit adds the `StableCompare` trait which is a companion trait to `StableOrd`. Some types like `Symbol` can be compared in a cross-session stable way, but their `Ord` implementation is not stable. In such cases, a `StableCompare` implementation can be provided to offer a lightweight way for stable sorting. The more heavyweight option is to sort via `ToStableHashKey`, but then sorting needs to have access to a stable hashing context and `ToStableHashKey` can also be expensive as in the case of `Symbol` where it has to allocate a `String`.

The rest of the commits are rather mechanical and don't overlap, so they are best reviewed individually.

Part of [MCP 533](rust-lang/compiler-team#533).
@bors
Copy link
Contributor

bors commented Dec 21, 2023

☀️ Try build successful - checks-actions
Build commit: 28f9060 (28f9060f96b97141dab0e267d633b408d5ec20c1)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (28f9060): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.2% [0.1%, 0.6%] 33
Regressions ❌
(secondary)
0.4% [0.1%, 0.9%] 39
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [0.1%, 0.6%] 33

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.3% [0.7%, 1.9%] 5
Regressions ❌
(secondary)
1.6% [0.8%, 2.4%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.0% [-4.7%, -3.2%] 2
All ❌✅ (primary) 1.3% [0.7%, 1.9%] 5

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.1% [3.1%, 3.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 1
All ❌✅ (primary) - - 0

Bootstrap: 673.174s -> 673.426s (0.04%)
Artifact size: 312.82 MiB -> 312.82 MiB (0.00%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Dec 21, 2023
@michaelwoerister
Copy link
Member Author

Yep, that looks like a real regression. I'll look into it.

@michaelwoerister
Copy link
Member Author

If I'm reading the cachegrind diff right, this is the culprit:
62fc1e7#diff-260026ed194b0aa8dd66fc4216bab5178f815f526842069ffc51a39708e7341fR1031

Details

--------------------------------------------------------------------------------
-- Summary
--------------------------------------------------------------------------------
Ir_______

4,578,847  PROGRAM TOTALS

--------------------------------------------------------------------------------
-- File:function summary
--------------------------------------------------------------------------------
  Ir________  file:function

<  4,610,220  ???:
   3,748,977    <hashbrown::raw::RawTable<(rustc_span::def_id::LocalDefId, rustc_hir::hir_id::ItemLocalId)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_span::def_id::LocalDefId, rustc_hir::hir_id::ItemLocalId, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>
  -3,748,531    <hashbrown::raw::RawTable<(rustc_ast::node_id::NodeId, rustc_hir::hir_id::ItemLocalId)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_ast::node_id::NodeId, rustc_hir::hir_id::ItemLocalId, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>
   2,871,292    core::slice::sort::recurse::<(&rustc_lint_defs::LintId, &(rustc_lint_defs::Level, rustc_middle::lint::LintLevelSource)), <[(&rustc_lint_defs::LintId, &(rustc_lint_defs::Level, rustc_middle::lint::LintLevelSource))]>::sort_unstable_by<<rustc_data_structures::unord::UnordMap<rustc_lint_defs::LintId, (rustc_lint_defs::Level, rustc_middle::lint::LintLevelSource)>>::to_sorted_stable_ord::{closure#0}>::{closure#0}>
   1,958,585    <rustc_lint::levels::LintLevelsBuilder<rustc_lint::levels::TopDown>>::push
    -967,971    <rustc_parse::parser::Parser>::collect_tokens_for_expr::<<rustc_parse::parser::Parser>::parse_expr_prefix::{closure#7}>::{closure#0}
     907,050    <rustc_parse::parser::Parser>::parse_expr_prefix::{closure#7}
    -157,234    <rustc_parse::parser::Parser>::parse_expr_assoc_with
      60,534    rustc_query_system::query::plumbing::ensure_must_run::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>
     -58,346    rustc_query_system::query::plumbing::ensure_must_run::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>
      28,895    <rustc_middle::ty::Ty as rustc_serialize::serialize::Decodable<rustc_middle::query::on_disk_cache::CacheDecoder>>::decode
      17,188    <hashbrown::raw::RawTable<(rustc_span::def_id::LocalDefId, rustc_span::def_id::CrateNum)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_span::def_id::LocalDefId, rustc_span::def_id::CrateNum, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>
     -17,186    <hashbrown::raw::RawTable<(rustc_ast::node_id::NodeId, rustc_ast::node_id::NodeId)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_ast::node_id::NodeId, rustc_ast::node_id::NodeId, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>
      12,963    <hashbrown::raw::RawTable<(rustc_span::def_id::LocalDefId, alloc::vec::Vec<rustc_span::def_id::DefId>)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_span::def_id::LocalDefId, alloc::vec::Vec<rustc_span::def_id::DefId>, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>
     -12,942    <hashbrown::raw::RawTable<(rustc_ast::node_id::NodeId, rustc_hir::def::PartialRes)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_ast::node_id::NodeId, rustc_hir::def::PartialRes, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>
     -11,715    <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
     -11,595    <rustc_query_system::ich::hcx::StableHashingContext as rustc_span::HashStableContext>::def_path_hash
      11,589    <rustc_query_system::ich::hcx::StableHashingContext>::def_path_hash
     -11,198    <rustc_lint_defs::LintBuffer>::take
     -11,146    <rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedPreExpansionLintPass> as rustc_ast::visit::Visitor>::visit_path
      11,029    <hashbrown::raw::RawTable<(rustc_span::def_id::LocalDefId, rustc_resolve::late::LifetimeUseSet)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_span::def_id::LocalDefId, rustc_resolve::late::LifetimeUseSet, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>
     -11,028    <hashbrown::raw::RawTable<(rustc_ast::node_id::NodeId, rustc_resolve::Module)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_ast::node_id::NodeId, rustc_resolve::Module, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>
      10,961    <hashbrown::raw::RawTable<(rustc_span::def_id::LocalDefId, ())>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_span::def_id::LocalDefId, (), core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>
      -9,214    <hashbrown::raw::RawTable<(rustc_ast::node_id::NodeId, ())>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_ast::node_id::NodeId, (), core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>
       6,785    <hashbrown::raw::RawTable<(rustc_span::def_id::LocalDefId, alloc::vec::Vec<(rustc_middle::hir::place::Place, rustc_middle::mir::syntax::FakeReadCause, rustc_hir::hir_id::HirId)>)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_span::def_id::LocalDefId, alloc::vec::Vec<(rustc_middle::hir::place::Place, rustc_middle::mir::syntax::FakeReadCause, rustc_hir::hir_id::HirId)>, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>
      -6,785    <hashbrown::raw::RawTable<(rustc_hir::hir_id::ItemLocalId, alloc::vec::Vec<rustc_middle::ty::Ty>)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_hir::hir_id::ItemLocalId, alloc::vec::Vec<rustc_middle::ty::Ty>, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>
      -5,364    <rustc_lint::BuiltinCombinedPreExpansionLintPass as rustc_lint::passes::EarlyLintPass>::check_ident
       5,286    core::slice::sort::insertion_sort_shift_left::<(&rustc_lint_defs::LintId, &(rustc_lint_defs::Level, rustc_middle::lint::LintLevelSource)), <[(&rustc_lint_defs::LintId, &(rustc_lint_defs::Level, rustc_middle::lint::LintLevelSource))]>::sort_unstable_by<<rustc_data_structures::unord::UnordMap<rustc_lint_defs::LintId, (rustc_lint_defs::Level, rustc_middle::lint::LintLevelSource)>>::to_sorted_stable_ord::{closure#0}>::{closure#0}>

<    -23,951  /usr/src/debug/glibc-2.36-18.fc37.x86_64/string/../sysdeps/x86_64/multiarch/../multiarch/strcmp-sse2.S:strcmp

<    -14,678  <all-jemalloc-files>:<all-jemalloc-functions>

<      8,718  /usr/src/debug/glibc-2.36-18.fc37.x86_64/elf/../sysdeps/generic/dl-new-hash.h:_dl_lookup_symbol_x

<      4,963  /usr/src/debug/glibc-2.36-18.fc37.x86_64/string/../sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S:__memcmp_avx2_movbe

--------------------------------------------------------------------------------
-- Function:file summary
--------------------------------------------------------------------------------
  Ir________  function:file

>  3,748,977  <hashbrown::raw::RawTable<(rustc_span::def_id::LocalDefId, rustc_hir::hir_id::ItemLocalId)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_span::def_id::LocalDefId, rustc_hir::hir_id::ItemLocalId, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>:???

> -3,748,531  <hashbrown::raw::RawTable<(rustc_ast::node_id::NodeId, rustc_hir::hir_id::ItemLocalId)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_ast::node_id::NodeId, rustc_hir::hir_id::ItemLocalId, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>:???

>  2,871,292  core::slice::sort::recurse::<(&rustc_lint_defs::LintId, &(rustc_lint_defs::Level, rustc_middle::lint::LintLevelSource)), <[(&rustc_lint_defs::LintId, &(rustc_lint_defs::Level, rustc_middle::lint::LintLevelSource))]>::sort_unstable_by<<rustc_data_structures::unord::UnordMap<rustc_lint_defs::LintId, (rustc_lint_defs::Level, rustc_middle::lint::LintLevelSource)>>::to_sorted_stable_ord::{closure#0}>::{closure#0}>:???

>  1,958,585  <rustc_lint::levels::LintLevelsBuilder<rustc_lint::levels::TopDown>>::push:???

>   -967,971  <rustc_parse::parser::Parser>::collect_tokens_for_expr::<<rustc_parse::parser::Parser>::parse_expr_prefix::{closure#7}>::{closure#0}:???

>    907,050  <rustc_parse::parser::Parser>::parse_expr_prefix::{closure#7}:???

>   -157,234  <rustc_parse::parser::Parser>::parse_expr_assoc_with:???

>     60,534  rustc_query_system::query::plumbing::ensure_must_run::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>:???

>    -58,346  rustc_query_system::query::plumbing::ensure_must_run::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>:???

>     28,895  <rustc_middle::ty::Ty as rustc_serialize::serialize::Decodable<rustc_middle::query::on_disk_cache::CacheDecoder>>::decode:???

>    -23,951  strcmp:/usr/src/debug/glibc-2.36-18.fc37.x86_64/string/../sysdeps/x86_64/multiarch/../multiarch/strcmp-sse2.S

>     17,188  <hashbrown::raw::RawTable<(rustc_span::def_id::LocalDefId, rustc_span::def_id::CrateNum)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_span::def_id::LocalDefId, rustc_span::def_id::CrateNum, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>:???

>    -17,186  <hashbrown::raw::RawTable<(rustc_ast::node_id::NodeId, rustc_ast::node_id::NodeId)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_ast::node_id::NodeId, rustc_ast::node_id::NodeId, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>:???

>    -14,678  <all-jemalloc-functions>:<all-jemalloc-files>

>     12,963  <hashbrown::raw::RawTable<(rustc_span::def_id::LocalDefId, alloc::vec::Vec<rustc_span::def_id::DefId>)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_span::def_id::LocalDefId, alloc::vec::Vec<rustc_span::def_id::DefId>, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>:???

>    -12,942  <hashbrown::raw::RawTable<(rustc_ast::node_id::NodeId, rustc_hir::def::PartialRes)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_ast::node_id::NodeId, rustc_hir::def::PartialRes, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>:???

>    -11,715  <rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>:???

>    -11,595  <rustc_query_system::ich::hcx::StableHashingContext as rustc_span::HashStableContext>::def_path_hash:???

>     11,589  <rustc_query_system::ich::hcx::StableHashingContext>::def_path_hash:???

>    -11,198  <rustc_lint_defs::LintBuffer>::take:???

>    -11,146  <rustc_lint::early::EarlyContextAndPass<rustc_lint::BuiltinCombinedPreExpansionLintPass> as rustc_ast::visit::Visitor>::visit_path:???

>     11,029  <hashbrown::raw::RawTable<(rustc_span::def_id::LocalDefId, rustc_resolve::late::LifetimeUseSet)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_span::def_id::LocalDefId, rustc_resolve::late::LifetimeUseSet, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>:???

>    -11,028  <hashbrown::raw::RawTable<(rustc_ast::node_id::NodeId, rustc_resolve::Module)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_ast::node_id::NodeId, rustc_resolve::Module, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>:???

>     10,961  <hashbrown::raw::RawTable<(rustc_span::def_id::LocalDefId, ())>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_span::def_id::LocalDefId, (), core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>:???

>     -9,214  <hashbrown::raw::RawTable<(rustc_ast::node_id::NodeId, ())>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_ast::node_id::NodeId, (), core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>:???

>      8,991  _dl_lookup_symbol_x:
       8,718    /usr/src/debug/glibc-2.36-18.fc37.x86_64/elf/../sysdeps/generic/dl-new-hash.h

>      6,785  <hashbrown::raw::RawTable<(rustc_span::def_id::LocalDefId, alloc::vec::Vec<(rustc_middle::hir::place::Place, rustc_middle::mir::syntax::FakeReadCause, rustc_hir::hir_id::HirId)>)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_span::def_id::LocalDefId, alloc::vec::Vec<(rustc_middle::hir::place::Place, rustc_middle::mir::syntax::FakeReadCause, rustc_hir::hir_id::HirId)>, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>:???

>     -6,785  <hashbrown::raw::RawTable<(rustc_hir::hir_id::ItemLocalId, alloc::vec::Vec<rustc_middle::ty::Ty>)>>::reserve_rehash::<hashbrown::map::make_hasher<rustc_hir::hir_id::ItemLocalId, alloc::vec::Vec<rustc_middle::ty::Ty>, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>::{closure#0}>:???

>     -5,364  <rustc_lint::BuiltinCombinedPreExpansionLintPass as rustc_lint::passes::EarlyLintPass>::check_ident:???

>      5,286  core::slice::sort::insertion_sort_shift_left::<(&rustc_lint_defs::LintId, &(rustc_lint_defs::Level, rustc_middle::lint::LintLevelSource)), <[(&rustc_lint_defs::LintId, &(rustc_lint_defs::Level, rustc_middle::lint::LintLevelSource))]>::sort_unstable_by<<rustc_data_structures::unord::UnordMap<rustc_lint_defs::LintId, (rustc_lint_defs::Level, rustc_middle::lint::LintLevelSource)>>::to_sorted_stable_ord::{closure#0}>::{closure#0}>:???

>      4,963  __memcmp_avx2_movbe:/usr/src/debug/glibc-2.36-18.fc37.x86_64/string/../sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S

--------------------------------------------------------------------------------
-- Annotated source file: /usr/src/debug/glibc-2.36-18.fc37.x86_64/elf/../sysdeps/generic/dl-new-hash.h
--------------------------------------------------------------------------------
Unannotated because one or more of these original files are unreadable:
- /usr/src/debug/glibc-2.36-18.fc37.x86_64/elf/../sysdeps/generic/dl-new-hash.h

--------------------------------------------------------------------------------
-- Annotated source file: /usr/src/debug/glibc-2.36-18.fc37.x86_64/string/../sysdeps/x86_64/multiarch/../multiarch/strcmp-sse2.S
--------------------------------------------------------------------------------
Unannotated because one or more of these original files are unreadable:
- /usr/src/debug/glibc-2.36-18.fc37.x86_64/string/../sysdeps/x86_64/multiarch/../multiarch/strcmp-sse2.S

--------------------------------------------------------------------------------
-- Annotated source file: /usr/src/debug/glibc-2.36-18.fc37.x86_64/string/../sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S
--------------------------------------------------------------------------------
Unannotated because one or more of these original files are unreadable:
- /usr/src/debug/glibc-2.36-18.fc37.x86_64/string/../sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S

--------------------------------------------------------------------------------
-- Annotated source file: <all-jemalloc-files>
--------------------------------------------------------------------------------
Unannotated because one or more of these original files are unreadable:
- <all-jemalloc-files>

--------------------------------------------------------------------------------
-- Annotation summary
--------------------------------------------------------------------------------
Ir_______

        0    annotated: files known & above threshold & readable, line numbers known
        0    annotated: files known & above threshold & readable, line numbers unknown
        0  unannotated: files known & above threshold & two or more non-identical
  -24,948  unannotated: files known & above threshold & unreadable
   -6,425  unannotated: files known & below threshold
4,610,220  unannotated: files unknown

@rustbot
Copy link
Collaborator

rustbot commented Dec 22, 2023

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@michaelwoerister
Copy link
Member Author

Let's see if 1530b8b does the trick.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 22, 2023
@bors
Copy link
Contributor

bors commented Dec 22, 2023

⌛ Trying commit 1530b8b with merge 198f5d0...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 22, 2023
Replace a number of FxHashMaps/Sets with stable-iteration-order alternatives

This PR replaces almost all of the remaining `FxHashMap`s in query results with either `FxIndexMap` or `UnordMap`. The only case that is missing is the `EffectiveVisibilities` struct which turned out to not be straightforward to transform. Once that is done too, we can remove the `HashStable` implementation from `HashMap`.

The first commit adds the `StableCompare` trait which is a companion trait to `StableOrd`. Some types like `Symbol` can be compared in a cross-session stable way, but their `Ord` implementation is not stable. In such cases, a `StableCompare` implementation can be provided to offer a lightweight way for stable sorting. The more heavyweight option is to sort via `ToStableHashKey`, but then sorting needs to have access to a stable hashing context and `ToStableHashKey` can also be expensive as in the case of `Symbol` where it has to allocate a `String`.

The rest of the commits are rather mechanical and don't overlap, so they are best reviewed individually.

Part of [MCP 533](rust-lang/compiler-team#533).
@michaelwoerister
Copy link
Member Author

@rust-lang/wg-compiler-performance, the way rustc-perf makes it easy to run cachegrind diffs is incredibly useful, by the way. I really appreciate all the effort that is going into this infrastructure!

@bors
Copy link
Contributor

bors commented Dec 22, 2023

☀️ Try build successful - checks-actions
Build commit: 198f5d0 (198f5d0267d73f0c061ae1297dfda30c2bdd1f9f)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (198f5d0): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.9% [0.1%, 4.5%] 162
Regressions ❌
(secondary)
1.6% [0.2%, 6.4%] 97
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [0.1%, 4.5%] 162

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.6% [0.7%, 3.7%] 6
Regressions ❌
(secondary)
1.3% [0.5%, 2.5%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.6% [0.7%, 3.7%] 6

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.9% [2.4%, 3.3%] 5
Regressions ❌
(secondary)
4.1% [2.5%, 5.5%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.9% [2.4%, 3.3%] 5

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 673.496s -> 673.938s (0.07%)
Artifact size: 312.79 MiB -> 312.79 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Dec 22, 2023
@michaelwoerister
Copy link
Member Author

That is not what I expected 😅

@michaelwoerister
Copy link
Member Author

@bors try @rust-timer queue

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 25, 2023
@michaelwoerister
Copy link
Member Author

Thanks for the review, @cjgillot! I'll follow up asap.

StableCompare is a companion trait to `StableOrd`. Some types like `Symbol` can be compared in a cross-session stable way, but their `Ord` implementation is not stable. In such cases, a `StableOrd` implementation can be provided to offer a lightweight way for stable sorting. (The more heavyweight option is to sort via `ToStableHashKey`, but then sorting needs to have access to a stable hashing context and `ToStableHashKey` can also be expensive as in the case of `Symbol` where it has to allocate a `String`.)
@michaelwoerister
Copy link
Member Author

I removed the two commits touching the LintLevelBuilder and addressed the comments (with the body_expr_count field gone, we can use #[derive(HashStable)] instead of the manual impl for ScopeTree \o/)

I don't think any of these changes warrant a new perf run.

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Jan 4, 2024

📌 Commit 077540c has been approved by cjgillot

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 4, 2024
@bors
Copy link
Contributor

bors commented Jan 5, 2024

⌛ Testing commit 077540c with merge b8c2074...

@bors
Copy link
Contributor

bors commented Jan 5, 2024

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing b8c2074 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 5, 2024
@bors bors merged commit b8c2074 into rust-lang:master Jan 5, 2024
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 5, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b8c2074): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.3% [0.1%, 0.5%] 7
Improvements ✅
(primary)
-0.4% [-0.6%, -0.2%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.4% [-0.6%, -0.2%] 2

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.3% [0.9%, 1.5%] 8
Regressions ❌
(secondary)
1.9% [1.9%, 1.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.7% [-3.7%, -0.8%] 7
All ❌✅ (primary) 1.3% [0.9%, 1.5%] 8

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.9% [-4.8%, -2.9%] 3
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 668.063s -> 665.928s (-0.32%)
Artifact size: 311.09 MiB -> 311.13 MiB (0.01%)

@Mark-Simulacrum Mark-Simulacrum added the perf-regression-triaged The performance regression has been triaged. label Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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.

7 participants