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

Cache all nested formatters #140480

Merged
merged 2 commits into from
Sep 13, 2022
Merged

Conversation

flash1293
Copy link
Contributor

If there are nested formatters within the agg formatters (like for range, date range or terms), it initializes a new formatter class for every call of the outer formatter. This is expensive and can quickly add up if there are a lot of data points:
Screenshot 2022-09-12 at 12 40 01

This PR applies the performance optimization that was already applied to the multi field terms also to the others:
Screenshot 2022-09-12 at 12 41 31

This reduces the runtime to roughly 1/20th of the original time, which matters for a lot of data points (the numbers above were obtained by rendering 47k data points with a terms formatter)

@flash1293 flash1293 added Team:AppServicesSv release_note:skip Skip the PR/issue when compiling release notes Feature:FieldFormatters backport:skip This commit does not require backporting labels Sep 12, 2022
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 430.7KB 430.8KB +138.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@flash1293 flash1293 marked this pull request as ready for review September 13, 2022 10:14
@flash1293 flash1293 requested a review from a team as a code owner September 13, 2022 10:14
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServicesSv)

Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

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

nice find!

@flash1293 flash1293 merged commit 340c6fb into elastic:main Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:FieldFormatters release_note:skip Skip the PR/issue when compiling release notes v8.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants