Skip to content
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

Can we improve the linear scan part of skipping to possibly compile to CMOVcc? #12476

Open
mikemccand opened this issue Jul 31, 2023 · 1 comment

Comments

@mikemccand
Copy link
Member

Description

@fulmicoton (Tantivy creator) reached out to me after our fun discussion about how to tap into branchless CPU instructions (CMOVcc on x86-64) from way up a in javaland far above the bare metal.

Because Lucene (and Tantivy) encode postings in blocks of 128 docids (+freqs) at once, when skipping, after using the skiplist to find the block that may or may not contain the target doc, there is inevitably a "within block" scan (of up to 128 docs) that is needed to find it.

@fulmicoton pointed out that the linear scan phase of Lucene's skipping could maybe be rewritten "just so" in a way that Hotspot would recognize it and would compile to CMOVcc. We could turn on "print assembly" from Hotspot to iterate until it does or does not produce CMOVcc and then measure which way is "typically" more performant.

@mikemccand
Copy link
Member Author

Thank you for the pointer @fulmicoton!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant