Skip to content

Conversation

@hoxxep
Copy link
Contributor

@hoxxep hoxxep commented Aug 5, 2025

Reduce the inlining cost of FoldHasher::write by marking hash_bytes_medium as #[inline(never)]. This reduces the inlining cost of Hash::hash(str) and means the write_length_prefix and finish methods are more likely to be inlined and efficiently optimise by the compiler.

StrUuid/hashonly-struuid-foldhash-fast                                                                             
                        time:   [3.8693 ns 3.8759 ns 3.8845 ns]
                        change: [-30.347% -30.207% -30.075%] (p = 0.00 < 0.05)
                        Performance has improved.

StrDate/hashonly-strdate-foldhash-fast                                                                             
                        time:   [1.3790 ns 1.3990 ns 1.4221 ns]
                        change: [-74.467% -74.116% -73.656%] (p = 0.00 < 0.05)
                        Performance has improved.

StrEnglishWord/hashonly-strenglishword-foldhash-fast                                                                             
                        time:   [1.4834 ns 1.4860 ns 1.4887 ns]
                        change: [-73.295% -73.243% -73.190%] (p = 0.00 < 0.05)
                        Performance has improved.

StrUrl/hashonly-strurl-foldhash-fast                                                                             
                        time:   [6.2293 ns 6.2748 ns 6.3197 ns]
                        change: [-17.006% -16.186% -15.326%] (p = 0.00 < 0.05)
                        Performance has improved.

Per discussion on #32

@hoxxep hoxxep force-pushed the medium-inline-never branch from bf3f2b2 to cf88427 Compare August 5, 2025 23:12
@orlp
Copy link
Owner

orlp commented Aug 6, 2025

Superseded by #35.

@orlp orlp closed this Aug 6, 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.

2 participants