Skip to content

Conversation

@gaujay
Copy link
Contributor

@gaujay gaujay commented Aug 18, 2025

Current implementation incurs a performance penalty as table gets full, in particular for lookup miss.
This is a good way to quantify and monitor this behavior so we can try improving it in the future.

Typical results look like this:

// FoldHashMap, RandomKeys
test loadfactor_lookup_14500             ... bench:       3,505.05 ns/iter (+/- 37.71)
test loadfactor_lookup_16500             ... bench:       3,474.36 ns/iter (+/- 11.88)
test loadfactor_lookup_18500             ... bench:       3,482.29 ns/iter (+/- 14.58)
test loadfactor_lookup_20500             ... bench:       3,478.73 ns/iter (+/- 20.59)
test loadfactor_lookup_22500             ... bench:       3,416.84 ns/iter (+/- 94.83)
test loadfactor_lookup_24500             ... bench:       3,450.97 ns/iter (+/- 82.86)
test loadfactor_lookup_26500             ... bench:       3,493.92 ns/iter (+/- 37.22)
test loadfactor_lookup_28500             ... bench:       3,484.17 ns/iter (+/- 24.00)

test loadfactor_lookup_fail_14500        ... bench:       2,900.72 ns/iter (+/- 28.27)
test loadfactor_lookup_fail_16500        ... bench:       3,009.21 ns/iter (+/- 23.97)
test loadfactor_lookup_fail_18500        ... bench:       3,157.28 ns/iter (+/- 24.10)
test loadfactor_lookup_fail_20500        ... bench:       3,480.48 ns/iter (+/- 27.06)
test loadfactor_lookup_fail_22500        ... bench:       4,048.19 ns/iter (+/- 47.99)
test loadfactor_lookup_fail_24500        ... bench:       5,265.12 ns/iter (+/- 65.23)
test loadfactor_lookup_fail_26500        ... bench:       7,494.26 ns/iter (+/- 90.56)
test loadfactor_lookup_fail_28500        ... bench:      11,593.97 ns/iter (+/- 108.62)

@gaujay
Copy link
Contributor Author

gaujay commented Aug 18, 2025

Unrelated clippy false positive:

#[allow(clippy::no_effect)] // false positive lint
map[&4];

src/map.rs Outdated
Comment on lines 5522 to 5523
#[allow(clippy::no_effect, clippy::unnecessary_operation)] // false positive lint
map[&4];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is clippy happy if you do something like this instead?

Suggested change
#[allow(clippy::no_effect, clippy::unnecessary_operation)] // false positive lint
map[&4];
_ = map[&4];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks.
There is still an issue with MSRV it seems:
error: package rayon-core v1.13.0 cannot be built because it requires rustc 1.80 or newer, while the currently active rustc version is 1.65.0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MSRV test is using -Z direct-minimal-versions, but that doesn't help the indirect rayon-core. This could be worked around by adding environment CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback to that command. Then we'll get minimal direct versions and compatible versions of everything else.

      Adding rayon v1.2.0 (available: v1.10.0)
      Adding rayon-core v1.12.1 (available: v1.13.0, requires Rust 1.80)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably worth a separate PR for these fixes that are unrelated to your benchmarks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. I'll drop the Clippy fix too eventually, just wanted to see if I could get the CI to run.
Should we ping someone to look into it?

@Amanieu
Copy link
Member

Amanieu commented Aug 20, 2025

CI should hopefully be fixed by #638.

@gaujay
Copy link
Contributor Author

gaujay commented Aug 21, 2025

Removed clippy fix. Ready to merge.

@Amanieu Amanieu added this pull request to the merge queue Aug 21, 2025
Merged via the queue into rust-lang:master with commit 71f8f37 Aug 21, 2025
31 of 33 checks passed
@github-actions github-actions bot mentioned this pull request Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants