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

Intern common TimeValue constants #107985

Conversation

DaveCTurner
Copy link
Contributor

The values 30s and 1m are used as defaults in various places in ES,
there's no need to create a new TimeValue instance each time they
appear. Moreover we already have constants for 0 and -1, but we
don't use these constants when reading the values off the wire.

This commit adds constants for 30s and 1m and adjusts the
deserialization code to avoid unnecessary allocation for common
TimeValue instances.

Relates #107984

The values `30s` and `1m` are used as defaults in various places in ES,
there's no need to create a new `TimeValue` instance each time they
appear. Moreover we already have constants for `0` and `-1`, but we
don't use these constants when reading the values off the wire.

This commit adds constants for `30s` and `1m` and adjusts the
deserialization code to avoid unnecessary allocation for common
`TimeValue` instances.

Relates elastic#107984
@DaveCTurner DaveCTurner added >non-issue :Core/Infra/Core Core issues without another label v8.15.0 labels Apr 28, 2024
@DaveCTurner DaveCTurner requested a review from ywangd April 28, 2024 10:24
@DaveCTurner DaveCTurner requested a review from a team as a code owner April 28, 2024 10:24
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Apr 28, 2024
@elasticsearchmachine
Copy link
Collaborator

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

@DaveCTurner DaveCTurner added the auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Apr 29, 2024
@elasticsearchmachine elasticsearchmachine merged commit 9242e01 into elastic:main Apr 29, 2024
14 checks passed
@DaveCTurner DaveCTurner deleted the 2024/04/28/intern-common-TimeValue branch April 29, 2024 09:41
Copy link
Member

@ywangd ywangd left a comment

Choose a reason for hiding this comment

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

LGTM

Sorry for behind the reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Core/Infra/Core Core issues without another label >non-issue Team:Core/Infra Meta label for core/infra team v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants