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

Make Step.StepKey a record #90755

Merged

Conversation

original-brownbear
Copy link
Member

@original-brownbear original-brownbear commented Oct 10, 2022

A bit of a random refactoring, but I found that master under heavy load gets surprisingly hot on the hashcode calculation in StepKey because that seems to not inline and actually sets up an Object[] array on every call when this thing is used for checking if there's work for an index.
Instead of fixing the hashCode to run faster, lets just use a record to do this out of the box and save the code for equals as well.

relates #77466

A bit of a random refactoring, but I found that master under heavy load
gets surprisingly hot on the hashcode calculation in `StepKey` because
that seems to not inline and actually sets up an `Object[]` array on
every call when this thing is used for checking if there's work for an
index.
Instead of fixing the hashCode to run faster, lets just use a record to
do this out of the box and save the code for equals and toString as
well.
@original-brownbear original-brownbear added >non-issue :Data Management/ILM+SLM Index and Snapshot lifecycle management v8.6.0 labels Oct 10, 2022
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticsearchmachine elasticsearchmachine added the Team:Data Management Meta label for data/management team label Oct 10, 2022
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Oct 10, 2022
Same reasoning as in elastic#90755, the hash code method in this thing is super
hot and accounts for 10%+ of all allocations on master in the many
shards snapshot benchmark -> lets use a record here instead to save some
code and get a fast version out of the box.
original-brownbear added a commit that referenced this pull request Oct 10, 2022
Same reasoning as in #90755, the hash code method in this thing is super
hot and accounts for 10%+ of all allocations on master in the many
shards snapshot benchmark -> lets use a record here instead to save some
code and get a fast version out of the box.
Copy link
Contributor

@joegallo joegallo left a comment

Choose a reason for hiding this comment

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

Nice, LGTM.

@original-brownbear
Copy link
Member Author

Thanks Joe!

@original-brownbear original-brownbear merged commit c167282 into elastic:main Oct 10, 2022
@original-brownbear original-brownbear deleted the make-step-key-record branch October 10, 2022 13:03
@original-brownbear original-brownbear restored the make-step-key-record branch November 30, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/ILM+SLM Index and Snapshot lifecycle management >non-issue Team:Data Management Meta label for data/management team v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants