rust icon indicating copy to clipboard operation
rust copied to clipboard

Use FxIndexMap instead FxHashMap to stabilize iteration order in EffectiveVisibilities

Open michaelwoerister opened this issue 11 months ago • 12 comments

Part of MCP 533.

michaelwoerister avatar Mar 01 '24 13:03 michaelwoerister

r? @cjgillot

rustbot has assigned @cjgillot. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot avatar Mar 01 '24 13:03 rustbot

@bors try @rust-timer queue

michaelwoerister avatar Mar 01 '24 13:03 michaelwoerister

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

rust-timer avatar Mar 01 '24 13:03 rust-timer

:hourglass: Trying commit a50490c5793516acb03c7b27d26177137b3f16f5 with merge 20a1b6db223806bd9fa3126be395eb2e7396680f...

bors avatar Mar 01 '24 14:03 bors

:sunny: Try build successful - checks-actions Build commit: 20a1b6db223806bd9fa3126be395eb2e7396680f (20a1b6db223806bd9fa3126be395eb2e7396680f)

bors avatar Mar 01 '24 16:03 bors

Queued 20a1b6db223806bd9fa3126be395eb2e7396680f with parent b0696a5160711c068cb1f01b7437db7990d15750, future comparison URL. There are currently 2 preceding artifacts in the queue. It will probably take at least ~2.6 hours until the benchmark run finishes.

rust-timer avatar Mar 01 '24 16:03 rust-timer

Finished benchmarking commit (20a1b6db223806bd9fa3126be395eb2e7396680f): comparison URL.

Overall result: ❌✅ regressions and improvements - 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.3%] 5
Regressions ❌
(secondary)
0.5% [0.4%, 0.6%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 4
All ❌✅ (primary) 0.2% [0.1%, 0.3%] 5

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)
- - 0
Regressions ❌
(secondary)
8.7% [5.7%, 11.0%] 5
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
Improvements ✅
(secondary)
-1.6% [-1.8%, -1.4%] 2
All ❌✅ (primary) -2.3% [-2.3%, -2.3%] 1

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)
-1.1% [-1.7%, -0.6%] 2
Improvements ✅
(secondary)
-4.1% [-5.7%, -2.1%] 6
All ❌✅ (primary) -1.1% [-1.7%, -0.6%] 2

Binary size

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

Bootstrap: 651.828s -> 653.326s (0.23%) Artifact size: 311.10 MiB -> 311.15 MiB (0.02%)

rust-timer avatar Mar 01 '24 22:03 rust-timer

I'm going to run a callgrind diff on the libc-check-full case to if the small regression is real.

michaelwoerister avatar Mar 04 '24 09:03 michaelwoerister

set_bindings_effective_visibilities (which uses the map in question) does show up with an instruction count increase for the libc and unused-warnings benchmarks. The code seems to do a bit more work with FxIndexMap instead of FxHashMap. However, I don't see how that can be changed without a bigger refactoring of code that otherwise does not look like it's in need of refactoring. Using UnordMap instead of FxIndexMap is non-trivial too, since EffectiveVisibilities public exposes an iter method that gives access to internal map.

I think the small regression is acceptable, since this is a correctness/incr-comp-hardening fix.

michaelwoerister avatar Mar 04 '24 09:03 michaelwoerister

@rustbot label: +perf-regression-triaged (please let me know if there's disagreement on that)

michaelwoerister avatar Mar 04 '24 10:03 michaelwoerister

Error: Parsing relabel command in comment failed: ...'on-triaged' | error: a label delta at >| ' (please l'...

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

rustbot avatar Mar 04 '24 10:03 rustbot

cc @petrochenkov as this touches effective visibilities.

cjgillot avatar Mar 10 '24 13:03 cjgillot

I just noticed that this is now the last instance of a HashMap occurring in a query result, so I pushed https://github.com/rust-lang/rust/pull/121851/commits/7e4bc4a373574ca727254cc7051ee42cb1102e06 which removes and disallows the HashStable impl for HashMap 🎉

michaelwoerister avatar Mar 27 '24 14:03 michaelwoerister

Effective visibility changes look ok. unused-warnings and libc are stress tests for effective visibilities, so they will regress a bit if FxIndexMap is any slower than FxHashMap.

petrochenkov avatar Mar 27 '24 14:03 petrochenkov

@bors r+

cjgillot avatar Mar 31 '24 13:03 cjgillot

:pushpin: Commit 7e4bc4a373574ca727254cc7051ee42cb1102e06 has been approved by cjgillot

It is now in the queue for this repository.

bors avatar Mar 31 '24 13:03 bors

:hourglass: Testing commit 7e4bc4a373574ca727254cc7051ee42cb1102e06 with merge 1e98e80418aff695ea4ae42f4e9aebb456da8525...

bors avatar Mar 31 '24 14:03 bors

The job armhf-gnu failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

rust-log-analyzer avatar Mar 31 '24 15:03 rust-log-analyzer

:broken_heart: Test failed - checks-actions

bors avatar Mar 31 '24 15:03 bors

@bors retry

cjgillot avatar Mar 31 '24 16:03 cjgillot

Gh gone crazy? Few first posts dated 1 mar, but written as "commented now".

klensy avatar Mar 31 '24 16:03 klensy

:hourglass: Testing commit 7e4bc4a373574ca727254cc7051ee42cb1102e06 with merge bf71daedc29e7a240261acd1516378047e311a6f...

bors avatar Mar 31 '24 16:03 bors

:sunny: Test successful - checks-actions Approved by: cjgillot Pushing bf71daedc29e7a240261acd1516378047e311a6f to master...

bors avatar Mar 31 '24 18:03 bors

Finished benchmarking commit (bf71daedc29e7a240261acd1516378047e311a6f): comparison URL.

Overall result: ❌ regressions - 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.3% [0.2%, 0.4%] 13
Regressions ❌
(secondary)
0.4% [0.3%, 0.4%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.2%, 0.4%] 13

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.5% [1.5%, 1.5%] 1
Regressions ❌
(secondary)
6.8% [2.0%, 10.2%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.5% [1.5%, 1.5%] 1

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)
-1.8% [-1.9%, -1.7%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.8% [-1.9%, -1.7%] 3

Binary size

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

Bootstrap: 669.417s -> 666.819s (-0.39%) Artifact size: 315.68 MiB -> 315.68 MiB (0.00%)

rust-timer avatar Mar 31 '24 19:03 rust-timer

See https://github.com/rust-lang/rust/pull/121851#issuecomment-1976192758 for justification.

Mark-Simulacrum avatar Apr 01 '24 18:04 Mark-Simulacrum