Optimize XContent Object Parsers#78813
Optimize XContent Object Parsers#78813original-brownbear merged 5 commits intoelastic:masterfrom original-brownbear:optimize-object-parsers
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.
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.
The typical size here is literally 2 :) I think that's the problem.
romseygeek
left a comment
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
Are we sure that the order here doesn't matter?
There was a problem hiding this comment.
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 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