tracing-log: Use a faster interest-cache hasher #3356
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!