Chronos is a performance-oriented time library for Haskell, with a straightforward API. The main differences between this and the time library are:
Jacob Stanley has written
a blog post comparing the features and performance
of time, thyme, and chronos. It has a good bulleted breakdown of why
you may want to use each library along with some benchmarks.
Benchmarks of chronos against time and thyme.
| Benchmark name | Time |
|---|---|
| Time.parseTimeM | 9.679 μs |
| Thyme.parseTime | 1.743 μs |
| Thyme.timeParser | 1.113 μs |
| Chronos.parserUtf8_YmdHMS | 301.4 ns |
| Chronos.zeptoUtf8_YmdHMS | 173.6 ns |
| Benchmark name | Time |
|---|---|
| dmy/Time.formatTime | 4.404 μs |
| dmy/Thyme.formatTime | 663.0 ns |
| dmy/Chronos.builder_Dmy | 340.9 ns |
| HMS/Time.formatTime | 1.987 μs |
| HMS/Thyme.formatTime | 879.1 ns |
| HMS/Chronos.builder_HMS | 481.3 ns |
Doctest used to be provided as a test suite, but doctest-0.20 and higher
do not require this to be run. To run the doctests, make sure you have
doctest on your path (i.e. run cabal install doctest), and then run:
cabal build
cabal repl --build-depends=QuickCheck --with-ghc=doctest --repl-options='-fno-warn-orphans'
This runs incredibly slowly, but it works for now. Doctest is not run by CI, so if you make a change that adds more doctests, it needs to be run by hand by someone. (The maintainer is happy to do this if you're on a platform where doctest is finicky.)
Haskell
99.8%
Chronos is a performance-oriented time library for Haskell, with a straightforward API. The main differences between this and the time library are:
Jacob Stanley has written
a blog post comparing the features and performance
of time, thyme, and chronos. It has a good bulleted breakdown of why
you may want to use each library along with some benchmarks.
Benchmarks of chronos against time and thyme.
| Benchmark name | Time |
|---|---|
| Time.parseTimeM | 9.679 μs |
| Thyme.parseTime | 1.743 μs |
| Thyme.timeParser | 1.113 μs |
| Chronos.parserUtf8_YmdHMS | 301.4 ns |
| Chronos.zeptoUtf8_YmdHMS | 173.6 ns |
| Benchmark name | Time |
|---|---|
| dmy/Time.formatTime | 4.404 μs |
| dmy/Thyme.formatTime | 663.0 ns |
| dmy/Chronos.builder_Dmy | 340.9 ns |
| HMS/Time.formatTime | 1.987 μs |
| HMS/Thyme.formatTime | 879.1 ns |
| HMS/Chronos.builder_HMS | 481.3 ns |
Doctest used to be provided as a test suite, but doctest-0.20 and higher
do not require this to be run. To run the doctests, make sure you have
doctest on your path (i.e. run cabal install doctest), and then run:
cabal build
cabal repl --build-depends=QuickCheck --with-ghc=doctest --repl-options='-fno-warn-orphans'
This runs incredibly slowly, but it works for now. Doctest is not run by CI, so if you make a change that adds more doctests, it needs to be run by hand by someone. (The maintainer is happy to do this if you're on a platform where doctest is finicky.)
Haskell
99.8%