Skip to content

attempt to optimize sorted_ords_to_term_cb #2664

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

trinity-1686a
Copy link
Contributor

make it so that operation doesn't need to query the index nearly as much (that operation isn't free on index v3)

@trinity-1686a trinity-1686a requested a review from PSeitz July 1, 2025 14:53
@trinity-1686a
Copy link
Contributor Author

we could get away with always returning the next block 1st ordinal, that looked like a regression in some bench, but it's also possible that was only noise

@@ -58,10 +58,13 @@ impl SSTableIndex {
}

/// Get the [`BlockAddr`] of the block containing the `ord`-th term.
pub(crate) fn get_block_with_ord(&self, ord: TermOrdinal) -> BlockAddr {
pub(crate) fn get_block_with_ord<const FETCH_NEXT_ORD: bool>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think FETCH_NEXT_ORD could be just a regular parameter. With inlining it will be the same code, and without I think it won't make a performance difference.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There are quite a bunch of fatty calls in between. I wouldn't bet on inlining happening here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also the goal of having this as a const generics was to not impact perf when we don't care about the upper bound ord, which isn't very expensive, but isn't free to fetch. But it looks like most benchs having regressed might not be using sstables at all (noisy bench?), so it's possible this added complexity brings nothing

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