Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bodigrim/tasty-bench-fit
Benchmark a given function for variable input sizes and find out its time complexity
https://github.com/bodigrim/tasty-bench-fit
algorithm-analysis algorithm-complexity asymptotics benchmark-framework complexity-analysis haskell nonlinear-regression performance-analysis performance-measurement performance-testing regression time-complexity time-complexity-analysis
Last synced: 10 days ago
JSON representation
Benchmark a given function for variable input sizes and find out its time complexity
- Host: GitHub
- URL: https://github.com/bodigrim/tasty-bench-fit
- Owner: Bodigrim
- License: mit
- Created: 2023-04-04T00:00:56.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-08T23:17:48.000Z (4 months ago)
- Last Synced: 2024-10-13T10:34:45.360Z (24 days ago)
- Topics: algorithm-analysis, algorithm-complexity, asymptotics, benchmark-framework, complexity-analysis, haskell, nonlinear-regression, performance-analysis, performance-measurement, performance-testing, regression, time-complexity, time-complexity-analysis
- Language: Haskell
- Homepage:
- Size: 20.5 KB
- Stars: 25
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# tasty-bench-fit
Benchmark a given function for variable input sizes and find out its time complexity.
```haskell
> fit $ mkFitConfig (\x -> sum [1..x]) (10, 10000)
1.2153e-8 * x
> fit $ mkFitConfig (\x -> Data.List.nub [1..x]) (10, 10000)
2.8369e-9 * x ^ 2
> fit $ mkFitConfig (\x -> Data.List.sort $ take (fromIntegral x) $ iterate (\n -> n * 6364136223846793005 + 1) (1 :: Int)) (10, 100000)
5.2990e-8 * x * log x
```One can usually get reliable results for functions, which do not allocate much: like in-place vector sort or fused list operations like `sum [1..x]`.
Unfortunately, fitting functions, which allocate a lot, is likely to be disappointing: GC kicks in irregularly depending on nursery and heap sizes and often skews observations beyond any recognition. Consider running such measurements with `-O0` or in `ghci` prompt. This is how the usage example above was generated. Without optimizations your program allocates much more and triggers GC regularly, somewhat evening out its effect.