weigh: Measure allocations of a Haskell functions/values

[ bsd3, library, web ] [ Propose Tags ]

Please see README.md


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.0, 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.0.10, 0.0.11, 0.0.12, 0.0.13, 0.0.14, 0.0.15, 0.0.16, 0.0.17 (info)
Change log CHANGELOG
Dependencies base (>=4.7 && <5), criterion-measurement, deepseq, ghc (>=8.2.1), mtl, process, split, temporary [details]
License BSD-3-Clause
Copyright FP Complete
Author Chris Done
Maintainer chrisdone@fpcomplete.com
Category Web
Home page https://github.com/fpco/weigh#readme
Uploaded by psibi at 2023-06-22T06:46:46Z
Distributions Arch:0.0.17, Debian:0.0.16, LTSHaskell:0.0.17, NixOS:0.0.17, Stackage:0.0.17
Reverse Dependencies 3 direct, 1 indirect [details]
Downloads 13850 total (111 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-06-22 [all 1 reports]

Readme for weigh-0.0.17

[back to package description]

weigh Tests

Measures the memory usage of a Haskell value or function

Limitations

  • ⚠️ Turn off the -threaded flag, otherwise it will cause inconsistent results.

Example use

import Weigh

main :: IO ()
main =
  mainWith
    (do func "integers count 0" count 0
        func "integers count 1" count 1
        func "integers count 10" count 10
        func "integers count 100" count 100)
  where
    count :: Integer -> ()
    count 0 = ()
    count a = count (a - 1)

Output results:

Case Allocated GCs
integers count 0 16 0
integers count 1 88 0
integers count 10 736 0
integers count 100 7,216 0

Output by default is plain text table; pass --markdown to get a markdown output like the above.