-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Speedup SearchResponse serialization #123211
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
Speedup SearchResponse serialization #123211
Conversation
No need to have a nested concat here. There's obviously lots and lots of room for optimization on this one, but just flattening out one obvious step here outright halves the number of method calls required when serializing a search response. Given that method calls can consume up to half the serialization cost this change might massively speed up some usecases.
|
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
|
|
||
| private Iterator<ToXContent> getToXContentIterator(boolean wrapInObject, ToXContent.Params params) { | ||
| return Iterators.concat( | ||
| wrapInObject ? ChunkedToXContentHelper.startObject() : Collections.emptyIterator(), |
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.
Very lazy solution admittedly here and for the end-object but it doesn't matter as the cost comes from the hits iterator anyway.
|
Thanks Luca! |
💔 Backport failed
You can use sqren/backport to manually backport by running |
No need to have a nested concat here. There's obviously lots and lots of room for optimization on this one, but just flattening out one obvious step here outright halves the number of method calls required when serializing a search response. Given that method calls can consume up to half the serialization cost this change might massively speed up some usecases.
No need to have a nested concat here. There's obviously lots and lots of room for optimization on this one, but just flattening out one obvious step here outright halves the number of method calls required when serializing a search response. Given that method calls can consume up to half the serialization cost this change might massively speed up some usecases.
No need to have two nested concat iterators here (each of which adding a layer of megamorphic calls + pointer indirection on every
nextandhasNext()!!!). There's obviously still lots and lots of room for optimization on this one, but just flattening out two obvious steps here enormously reduces the number of method calls required when serializing a search response. Given that method calls can consume up to half the serialization cost this change might massively speed up some use cases.