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

@DateTimeFormat(iso = ISO.DATE_TIME) should use optimized formatter for LocalDateTime [SPR-14958] #19525

spring-projects-issues opened this issue Nov 28, 2016 · 1 comment


Copy link

@spring-projects-issues spring-projects-issues commented Nov 28, 2016

Oliver Drotbohm opened SPR-14958 and commented

It looks like the usage of DateTimeFormatter.ISO_DATE_TIME to format LocalDateTime instances is significantly slower than a usage of DateTimeFormatter.ISO_LOCAL_DATE_TIME (see this benchmark for details).

It would be cool if we could switch to that DateTimeFormatter in case a LocalDateTime instance is to be converted.

Affects: 4.3.4, 5.0 M3

Issue Links:

  • #19239 Align ISO timezone parsing in DateFormatter with Joda-Time / JSR-310
  • #19493 Improve performance for conversions using a method parameter based type descriptor with annotations
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Nov 30, 2016

Juergen Hoeller commented

We've got specific checks for printing LocalDate / LocalTime / LocalDateTime now, automatically switching to ISO_LOCAL_DATE / ISO_LOCAL_TIME / {{ISO_LOCAL_DATE_TIME}... but just for printing, not for parsing, since the non-local variants turn out to leniently strip zone information in an input string whereas the local variants strictly reject those. Since there is only a performance benefit in printing anyway according to my tests, this compromise should be alright.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.