@hackage fast-arithmetic0.3.0.3
Fast functions on integers.
Categories
License
BSD-3-Clause
Maintainer
vamchale@gmail.com
Links
Versions
Installation
CustomDependencies (5)
- base >=4.7 && <5
- composition-prelude <1.2.0.0
- foundation <0.0.18
- memory <0.14.11
- recursion-schemes Show all…
Dependents (2)
@hackage/acme-everything, @hackage/apple
Package Flags
development
(off by default)
Enable `-Werror` and don't clean ATS libraries between builds.
fast-arithmetic
This is a library for fast arithmetical functions using ATS, with a Haskell wrapper.
It is intended to supplement (but not replace) arithmoi and combinat where speed is important. In particular, this library provides a fast primality check and fast computation of basic combinatorial functions.
Benchmarks
| Computation | Version (ATS/Haskell) | Time |
|---|---|---|
isPrime 2017 |
ATS | 118.9 ns |
isPrime 2017 |
Haskell | 497.3 ns |
φ(2016) |
ATS | - |
φ(2016) |
Haskell | - |
τ(3018) |
ATS | 438.5 ns |
τ(3018) |
Haskell | 726.4 ns |
σ(115) |
ATS | 216.3 ns |
σ(115) |
Haskell | 324.5 ns |
ω(91) |
ATS | 66.59 ns |
ω(91) |
Haskell | 338.6 ns |
160! |
ATS | 4.081 μs |
160! |
Haskell | 6.032 μs |
79!! |
ATS | 813.8 ns ns |
79!! |
Haskell | 1.395 μs |
322 `choose` 16 |
ATS | 629.8 ns |
322 `choose` 16 |
Haskell | 1.046 μs |
See here for more.
Building
The Haskell library comes with the C bundled, however you will likely want to build from source if you are hacking on the library. To that end, you can install stack, patsopt, and pats-filter and build with
$ ./shake.hs
You will also likely want to install GHC as well as cabal.
Documentation
You can find documentation for the Haskell library on Hackage. Unfortunately, there is no documentation for the ATS library, however, the bundled source code is commented.