fpco/weigh

Measure allocations of a Haskell functions/values

Haskell

101

120 commits

updated Nov 1, 2024

See the code

README

weigh Tests

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

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 a markdown output like the above.

Contributors

chrisdone

95 commits

nobrakal

8 commits

psibi

7 commits

lehins

3 commits

fpco/weigh

Measure allocations of a Haskell functions/values

Haskell

101

120 commits

updated Nov 1, 2024

See the code

README

weigh Tests

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

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 a markdown output like the above.

Contributors

chrisdone

95 commits

nobrakal

8 commits

psibi

7 commits

lehins

3 commits

Languages

Haskell

100.0%