Skip to content

Comments

Faster ISO date formatter / parser#5070

Merged
DanielNovak merged 2 commits intodevelopfrom
faster_iso_date
Nov 20, 2023
Merged

Faster ISO date formatter / parser#5070
DanielNovak merged 2 commits intodevelopfrom
faster_iso_date

Conversation

@DanielNovak
Copy link
Contributor

Our API is currently quite heavy on the usage ISO date which are notoriously slow to parse. There is a plan to replace this with Unix timestamps but in the short term we can use a small ISO parser and formatter - https://github.com/ethlo/itu/ . According to the docs and also to my tests the speed is significantly faster - up 10x, in our API response parsing scenario it seems to be "only" 4x faster than the Java Instant but that is still a massive saving.

I have also added the usage of Instant into our util DateTimeFormatter. This one is used from our Compose components and while the absolute time saving is minimal (5ms vs ~3ms) on each item drawn - it still can make a difference because this is done on the UI thread.

In the long run we will make the JSON structure more efficient and replace the ISO date with Unix timestamps, but until that this is worthy upgrade.

@DanielNovak DanielNovak added performance Any kind of performance problems: rendering, parsing, reading/writing v6 labels Nov 19, 2023
@DanielNovak DanielNovak requested a review from a team as a code owner November 19, 2023 07:29
@DanielNovak DanielNovak force-pushed the faster_iso_date branch 2 times, most recently from 74d3635 to 33a1bbd Compare November 19, 2023 07:37
Copy link
Contributor

@kanat kanat left a comment

Choose a reason for hiding this comment

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

LGTM

Nice catch 👍

@DanielNovak DanielNovak enabled auto-merge (squash) November 20, 2023 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Any kind of performance problems: rendering, parsing, reading/writing v6

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants