weigh

Measure allocations of a Haskell functions/values https://github.com/fpco/weigh#readme

Version on this page:0.0.12
LTS Haskell 15.13:0.0.16
Stackage Nightly 2020-05-26:0.0.16
Latest on Hackage:0.0.16

See all snapshots weigh appears in

BSD-3-Clause licensed by Chris Done
Maintained by [email protected]

Module documentation for 0.0.12

This version can be pinned in stack with:[email protected]:8c9c0be2e46ced331a695fd80eaca2a7b062521e0d487087fe82ddec5a1e4c4e,1119

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.