Skip to content

Speed up converting of temporal accessor to zoned date time#38172

Merged
spinscale merged 1 commit intoelastic:6.xfrom
spinscale:1902-6.x-backport-performance-fix
Feb 1, 2019
Merged

Speed up converting of temporal accessor to zoned date time#38172
spinscale merged 1 commit intoelastic:6.xfrom
spinscale:1902-6.x-backport-performance-fix

Conversation

@spinscale
Copy link
Copy Markdown
Contributor

The existing implementation was slow due to exceptions being thrown if
an accessor did not have a time zone. This implementation queries for
having a timezone, local time and local date and also checks for an
instant preventing to throw an exception and thus speeding up the conversion.

This removes the existing method and create a new one named
DateFormatters.from(TemporalAccessor accessor) to resemble the naming of
the java time ones.

Before this change an epoch millis parser using the toZonedDateTime
method took approximately 50x longer.

Relates #37826

This commit also backports #38171

The existing implementation was slow due to exceptions being thrown if
an accessor did not have a time zone. This implementation queries for
having a timezone, local time and local date and also checks for an
instant preventing to throw an exception and thus speeding up the conversion.

This removes the existing method and create a new one named
DateFormatters.from(TemporalAccessor accessor) to resemble the naming of
the java time ones.

Before this change an epoch millis parser using the toZonedDateTime
method took approximately 50x longer.

Relates elastic#37826

This commit also backports elastic#38171
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant