-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Optimize XContent Object Parsers #78813
Optimize XContent Object Parsers #78813
Conversation
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.
Pinging @elastic/es-core-infra (Team:Core/Infra) |
Pinging @elastic/es-data-management (Team:Data Management) |
} | ||
} | ||
return new Phase(name, (TimeValue) a[0], map); | ||
}); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
@@ -228,7 +229,7 @@ public void testReadStepKeys() { | |||
" \"version\" : 1,\n" + | |||
" \"modified_date_in_millis\" : 1578521007076\n" + | |||
" }", "phase", null), | |||
contains(new Step.StepKey("phase", "rollover", WaitForRolloverReadyStep.NAME), | |||
containsInAnyOrder(new Step.StepKey("phase", "rollover", WaitForRolloverReadyStep.NAME), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Thanks Alan! |
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.
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.
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