Skip to content

Test reference equality before structural equality#1644

Open
wmdietl wants to merge 2 commits intomasterfrom
equalstores
Open

Test reference equality before structural equality#1644
wmdietl wants to merge 2 commits intomasterfrom
equalstores

Conversation

@wmdietl
Copy link
Copy Markdown
Member

@wmdietl wmdietl commented Apr 21, 2026

This was highlighted as a hot path and seems a simple optimization.

Copilot AI review requested due to automatic review settings April 21, 2026 01:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Optimizes equality checks in CFAbstractStore by short-circuiting on reference equality before performing potentially more expensive structural equality checks, improving performance in a known hot path.

Changes:

  • In supersetOf, checks value == eValue before calling value.equals(eValue) across all internal maps.
  • In equals, adds an early this == o return to avoid unnecessary work when comparing the same instance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@wmdietl
Copy link
Copy Markdown
Member Author

wmdietl commented Apr 21, 2026

@copilot Can you measure whether this has any performance benefit compared to CI running on master?

Copy link
Copy Markdown

Copilot AI commented Apr 21, 2026

@copilot Can you measure whether this has any performance benefit compared to CI running on master?

Measured from CI data: for commit 2a1a2e0 (run 24699423593), 10 JDK-21 jobs completed before cancellation. Compared to the same jobs averaged over 3 recent successful master CI runs, the completed jobs were ~6.8% faster on average (most jobs faster, a couple within noise/slightly slower). This suggests a small positive benefit, but it’s not statistically rigorous since that PR run was cancelled and sample size is limited.

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