Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fast and correct aeson instances for UTCTime #45

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

Open
ondrap wants to merge 4 commits into haskell-github-trust:master
base: master
Choose a base branch
Loading
from ondrap:master

Conversation

@ondrap
Copy link

@ondrap ondrap commented May 28, 2016

This patch does several things:

  • adds benchmark for Thyme aeson UTCTime encode and parse vs. Time instances
  • adds faster encoding/parsing instances for UTCTime: they used to be ~ twice slower than time, now it is ~2 times faster. I basically copied the encoding instance from aeson and I have written the parsing myself.
  • adds quickcheck tests for these instances; the instances are correct (i.e. decode (encode time)) == Just time for time between 1AC-9999AC).
  • fixes problems with compilation with older versions of GHC, now it passes the Travis checks completely for all GHC versions
  • I didn't touch the ZonedTime instance as it seemed to me it parsed more formats than I would expect (the RFC3339) - if you feel I should change that, send me a note and I could do that.
  • I have added dependency on the scanner package; the parser is about twice as fast as an identical attoparsec parser, I think it makes sense

Benchmark results:

benchmarking time encode/time/encode
time 1.097 μs (1.058 μs .. 1.146 μs)
 0.990 R2 (0.981 R2 .. 0.998 R2)
mean 1.072 μs (1.049 μs .. 1.115 μs)
std dev 96.30 ns (57.69 ns .. 168.7 ns)
variance introduced by outliers: 86% (severely inflated)
benchmarking time encode/thyme/encode
time 547.6 ns (537.6 ns .. 566.3 ns)
 0.992 R2 (0.981 R2 .. 0.999 R2)
mean 558.1 ns (545.7 ns .. 583.9 ns)
std dev 55.11 ns (35.69 ns .. 89.25 ns)
variance introduced by outliers: 89% (severely inflated)
benchmarking time decode/time/decode
time 2.467 μs (2.438 μs .. 2.493 μs)
 0.999 R2 (0.998 R2 .. 0.999 R2)
mean 2.475 μs (2.448 μs .. 2.506 μs)
std dev 100.6 ns (82.19 ns .. 128.5 ns)
variance introduced by outliers: 54% (severely inflated)
benchmarking time decode/thyme/decode
time 856.0 ns (850.2 ns .. 862.2 ns)
 0.999 R2 (0.999 R2 .. 1.000 R2)
mean 859.9 ns (852.5 ns .. 868.4 ns)
std dev 25.96 ns (20.86 ns .. 33.31 ns)
variance introduced by outliers: 42% (moderately inflated)

parsonsmatt and llelf reacted with thumbs up emoji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /