Skip to content

Optimize data structures used by librasan #3227

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

Merged
merged 1 commit into from
May 15, 2025

Conversation

WorksButNotTested
Copy link
Collaborator

Description

Replace BTreeMap and BTreeSet with hashbrown data types.

Checklist

  • I have run ./scripts/precommit.sh and addressed all comments

@domenukk domenukk merged commit e3a3dfb into AFLplusplus:main May 15, 2025
109 checks passed
@domenukk
Copy link
Member

We should do this, eventually :D
#3218

XXH3 is fast but more optimized for files IIRC, not for small ahash-like problems

@domenukk
Copy link
Member

we have a cargo bench for them

@WorksButNotTested WorksButNotTested deleted the btree branch May 15, 2025 07:28
@WorksButNotTested
Copy link
Collaborator Author

@wfdewith FYI.

@wfdewith
Copy link
Contributor

One question: my understanding is that ahash is very fast because it exploits hardware acceleration for AES instructions. Does QEMU emulate this, especially cross-architecture? Since we're only hashing GuestAddr which are always 32 or 64 bits integers and we don't need DoS resistance for those either, I would assume without any testing that fxhash is faster than ahash for these purposes.

@WorksButNotTested
Copy link
Collaborator Author

One question: my understanding is that ahash is very fast because it exploits hardware acceleration for AES instructions. Does QEMU emulate this, especially cross-architecture? Since we're only hashing GuestAddr which are always 32 or 64 bits integers and we don't need DoS resistance for those either, I would assume without any testing that fxhash is faster than ahash for these purposes.

You know more than me. I just went with it because it said it was fairly quick. TBH, I think the majority of the performance improvement comes from moving from BTree based storage to hash based. Happy to take a PR to change the algo if you prefer?

@wfdewith
Copy link
Contributor

I'll try to spend some time this weekend to write a benchmark under QEMU, which will give us some hard numbers to compare.

@WorksButNotTested
Copy link
Collaborator Author

@wfdewith Cool, sounds good. Care to join the discord? Might be easier than communicating through issues in future?
https://discord.gg/gCraWct

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