Skip to content

Conversation

@devinrsmith
Copy link
Member

@devinrsmith devinrsmith commented Jul 19, 2024

The logic is identical, but this provides the JVM a more specific target to optimize.

@devinrsmith devinrsmith added this to the 0.36.0 milestone Jul 19, 2024
@devinrsmith devinrsmith self-assigned this Jul 19, 2024
@devinrsmith devinrsmith force-pushed the perf-mega-merge-kernels branch from a17b502 to c947b31 Compare July 21, 2024 00:21
@devinrsmith devinrsmith marked this pull request as ready for review July 21, 2024 00:21
@devinrsmith devinrsmith requested a review from rcaudy July 21, 2024 00:21
final long mid = (lo + hi) >>> 1;
final char testValue = valuesToSort.getUnsafe(mid);
final boolean moveLo = doComparison(testValue, searchValue) <= compareLimit;
final boolean moveLo = strict ? lt(testValue, searchValue) : leq(testValue, searchValue);
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if this matters a lot, but the previous version was written to branch only once, outside the while loop, instead of on every iteration. I imagine a JIT compiler can optimize this, though, and it the suppression on the method suggests that we only take one of these branches ever.

@SuppressWarnings("SameParameterValue") final boolean lower) {
final int compareLimit = lower ? -1 : 0; // lt or leq

@SuppressWarnings("SameParameterValue") final boolean strict) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think renaming this is aiding clarity.

@pete-petey pete-petey modified the milestones: 0.36.0, 0.37.0 Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants