Skip to content

Optimize XContent Object Parsers#78813

Merged
original-brownbear merged 5 commits intoelastic:masterfrom
original-brownbear:optimize-object-parsers
Oct 21, 2021
Merged

Optimize XContent Object Parsers#78813
original-brownbear merged 5 commits intoelastic:masterfrom
original-brownbear:optimize-object-parsers

Conversation

@original-brownbear
Copy link
Copy Markdown
Contributor

Optimize object parsers a little by extracting cold paths, removing some unecessary
lambda wrapping and some other small things.
Also, fixed a very expensive use of these APIs in Phase moving from a very hot stream
instantiation to a standard loop.

relates #77466

Optimize object parsers a little by extracting cold paths, removing some unecessary
lambda wrapping and some other small things.
Also, fixed a very expensive use of these APIs in Phase moving from a very hot stream
instantiation to a standard loop.
@original-brownbear original-brownbear added >non-issue :Core/Infra/Core Core issues without another label :Data Management/ILM+SLM DO NOT USE. Use ":StorageEngine/ILM" or ":Distributed Coordination/SLM" instead. v8.0.0 v7.16.0 labels Oct 7, 2021
@elasticmachine elasticmachine added Team:Core/Infra Meta label for core/infra team Team:Data Management (obsolete) DO NOT USE. This team no longer exists. labels Oct 7, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticmachine
Copy link
Copy Markdown
Collaborator

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

}
}
return new Phase(name, (TimeValue) a[0], map);
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I find this kind of curious. I assume this is the very expensive / hot stream instantiation referred to in the description, right? I'm surprised that the declarative stream variant is less performant than the imperative loop. It could be worth extracting into a micro benchmark and getting some perf numbers for typical collection sizes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The typical size here is literally 2 :) I think that's the problem.

Copy link
Copy Markdown
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

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

One query, but LGTM otherwise.

" \"modified_date_in_millis\" : 1578521007076\n" +
" }", "phase", null),
contains(new Step.StepKey("phase", "rollover", WaitForRolloverReadyStep.NAME),
containsInAnyOrder(new Step.StepKey("phase", "rollover", WaitForRolloverReadyStep.NAME),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are we sure that the order here doesn't matter?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Doesn't look like it does and also this wasn't actually deterministic before either. As far as I can tell, it was just random luck that it would work out the way it did anyway. The map(s) that this is build from are just hashmaps in master as well. It's just that this PR makes them pre-sized more efficiently so the order of how stuff falls into place changes.

@original-brownbear
Copy link
Copy Markdown
Contributor Author

Thanks Alan!

@original-brownbear original-brownbear merged commit 0e8a00b into elastic:master Oct 21, 2021
@original-brownbear original-brownbear deleted the optimize-object-parsers branch October 21, 2021 11:00
original-brownbear added a commit that referenced this pull request Oct 22, 2021
Optimize object parsers a little by extracting cold paths, removing some unnecessary
lambda wrapping and some other small things.
Also, fixed a very expensive use of these APIs in Phase moving from a very hot stream
instantiation to a standard loop.
@original-brownbear original-brownbear restored the optimize-object-parsers branch April 18, 2023 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Core Core issues without another label :Data Management/ILM+SLM DO NOT USE. Use ":StorageEngine/ILM" or ":Distributed Coordination/SLM" instead. >non-issue Team:Core/Infra Meta label for core/infra team Team:Data Management (obsolete) DO NOT USE. This team no longer exists. v7.16.0 v8.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants