Skip to content

tracing-log: Use a faster interest-cache hasher #3356

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hoxxep
Copy link

@hoxxep hoxxep commented Aug 4, 2025

Motivation

ahash benchmarks to 13ns on log_from_multiple_threads

rapidhash benchmarks to 9ns on log_from_multiple_threads

Solution

I've recently released rapidhash v3.0 which is faster than ahash on every platform I have benchmarked, especially for hashing integer pairs and shorter strings. There are benchmarks for u64 pairs detailed on various server platforms in the docs folder of the repo to demonstrate a consistent ~35% improvement of hashing integer pairs over ahash.

This MR significantly improves the performance of the interest cache by changing the LRU cache hasher to rapidhash. Rapidhash has a high quality hash output (passes the SMHasher3 hash benchmarks), is cross-platform, and minimally DoS resistant, so I don't believe there is a drawback to switching? I appreciate I'm biased though!

@hoxxep hoxxep requested review from hawkw and a team as code owners August 4, 2025 17:25
@hoxxep hoxxep force-pushed the intererst-cache-rapidhash branch from 0683850 to f877db8 Compare August 4, 2025 17:28

[dev-dependencies]
tracing = { path = "../tracing", version = "0.1.35"}
tracing-subscriber = { path = "../tracing-subscriber" }
criterion = { version = "0.3.6", default-features = false }
tracing-subscriber = { path = "../tracing-subscriber", features = ["env-filter"] }
Copy link
Author

Choose a reason for hiding this comment

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

I can't tell if this feature here is breaking the build. It's required to run the benchmarks, but will remove from the commit.

@hoxxep hoxxep force-pushed the intererst-cache-rapidhash branch from f877db8 to cf63c4c Compare August 4, 2025 17:46
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.

1 participant