Skip to content

Prefetch#4

Open
RagnarGrootKoerkamp wants to merge 6 commits intofeldroop:masterfrom
RagnarGrootKoerkamp:prefetch
Open

Prefetch#4
RagnarGrootKoerkamp wants to merge 6 commits intofeldroop:masterfrom
RagnarGrootKoerkamp:prefetch

Conversation

@RagnarGrootKoerkamp
Copy link
Copy Markdown
Contributor

@RagnarGrootKoerkamp RagnarGrootKoerkamp commented Dec 24, 2025

This adds the ability to prefetch the cacheline required to answer a rank query.

I'm not quite sure I did it correctly though... should be fixed now
In my evals (https://curiouscoding.nl/posts/quadrank/#evals), the data points (the black plusses) get better when going from for to stream with prefetch.

My wrapping code is here: https://github.com/RagnarGrootKoerkamp/quadrank/blob/master/src/genedex.rs

@RagnarGrootKoerkamp RagnarGrootKoerkamp force-pushed the prefetch branch 2 times, most recently from 1f27e25 to acccda7 Compare December 27, 2025 23:28
@feldroop
Copy link
Copy Markdown
Owner

Hello @RagnarGrootKoerkamp,
Thank you for the issues and this PR. I will work on this repo in the next couple of days and I'll try to address everything. My goal also is to do some more profiling and optimizing, to get closer to the performance of your implementation. Maybe I'll even be able to add an implementation of the FMD-index.

@feldroop
Copy link
Copy Markdown
Owner

feldroop commented Jan 1, 2026

Just out of curiousity, did you measure a performance improvement from the inline annotations? I think it's fine to have them, but I assumed that the compiler already does is it, at least for the smaller functions where it makes a significant difference. Or is there another technical reason for the inlining?

@RagnarGrootKoerkamp
Copy link
Copy Markdown
Contributor Author

They're not always necessary, but one non-inline function can massively (10-20%) impact perf. Just yesterday I had an add([[u64;4],[u64;4]) function not unlined even though it's pretty trivial.
Specifically if other functions become large it does sometimes happen that smaller functions are not inlined in my experience, so now I just like to put them just to be safe.

Also, inlining constructors and such allows the compiler to see into the actual data structure which can help optimizing the querying as well.

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