weigh

Measure allocations of a Haskell functions/values

https://github.com/fpco/weigh#readme

Version on this page:0.0.14
LTS Haskell 22.14:0.0.17
Stackage Nightly 2024-03-28:0.0.17
Latest on Hackage:0.0.17

See all snapshots weigh appears in

BSD-3-Clause licensed by Chris Done
Maintained by [email protected]
This version can be pinned in stack with:weigh-0.0.14@sha256:655ff8086b9704828102872a48cfd968b355352d4ee1a01b42a2e033eb8639e1,1119

Module documentation for 0.0.14

weigh Build Status

Measures the memory usage of a Haskell value or function

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.