Skip to content

improve performance of the date/time transformer during feature decoding#559

Merged
azahnen merged 2 commits into
masterfrom
parse-date-time
Jul 10, 2026
Merged

improve performance of the date/time transformer during feature decoding#559
azahnen merged 2 commits into
masterfrom
parse-date-time

Conversation

@cportele

Copy link
Copy Markdown
Contributor

The DATE_FORMAT value transformer did avoidable work for every value:

  • it rebuilt the input parser and the output formatter on each call;
  • parse() used parseBest with OffsetDateTime/LocalDateTime/LocalDate queries, so every value without an offset threw - and filled in a stack trace - before falling through to the next query.

Now the input parser is a shared constant, the output formatter is cached per transformer, and parse() resolves the value once and branches on the fields that are present (offset / time / date) instead of throwing. parse() keeps its signature for its other caller; output is unchanged.

The DATE_FORMAT value transformer did avoidable work for every value:

- it rebuilt the input parser and the output formatter on each call;
- parse() used parseBest with OffsetDateTime/LocalDateTime/LocalDate
  queries, so every value without an offset threw - and filled in a
  stack trace - before falling through to the next query.

Now the input parser is a shared constant, the output formatter is cached
per transformer, and parse() resolves the value once and branches on the
fields that are present (offset / time / date) instead of throwing.
parse() keeps its signature for its other caller; output is unchanged.
@cportele cportele requested a review from azahnen as a code owner June 29, 2026 11:29
@azahnen azahnen enabled auto-merge (squash) July 10, 2026 09:56
@azahnen azahnen merged commit ebd3599 into master Jul 10, 2026
3 checks passed
@azahnen azahnen deleted the parse-date-time branch July 10, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants