weigh

Measure allocations of a Haskell functions/values

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

LTS Haskell 23.27:0.0.18
Stackage Nightly 2025-07-13:0.0.18
Latest on Hackage:0.0.18

See all snapshotsweigh appears in

BSD-3-Clause licensedbyChris Done
Maintained by[email protected]
This version can be pinned in stack with:weigh-0.0.18@sha256:78b183a32f86b216db889965da1c67992263040f440ad71d65e4454c36a6dba1,1214

Module documentation for 0.0.18

weighTests

Measures the memory usage of a Haskell value or function

Limitations

  • :warning: Turn off the-threaded flag, otherwise it will cause inconsistent results.

Example use

import Weighmain :: 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:

CaseAllocatedGCs
integers count 0160
integers count 1880
integers count 107360
integers count 1007,2160

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