-
-
Notifications
You must be signed in to change notification settings - Fork 290
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
Use xxhash with salt for fastMsgIdFn #4630
Conversation
Performance Report✔️ no performance regression detected Full benchmark results
|
the benchmark looks great, suggest to test this on a node for 1 day before merge |
@dapplion I deployed this branch to feat1 lg1k |
this looks promising, initially it takes 200ms - 300ms this correlates to the memory issue with this branch to avoid the String creation, we should try ChainSafe/js-libp2p-gossipsub#355 |
This is a low-priority optimization, not worth risking a memory leak for this. @tuyennhv if you want confirm that number causes the leak or not else let's close this PR |
closing this PR as it still has a memory issue after I tried numbered FastMsgIdFn version (200ms - 300ms - this branch vs 1.5s - 2s - unstable |
Motivation
fastMsgIdFn() must produce a unique output per message within the message of the last few heartbeats. We can use any hash function so we should go for the cheapest possible with good safety.
sha256 on a node subscribed to all subnets it can take 0.5% of total CPU time.
xxhash is a cryptographically unsafe function that's has really good performance and good distribution of output. This PR also adds salt so an attacker can't pre-compute collisions.
Description
Closes #4603