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

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

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 (info)
Change log CHANGELOG
Dependencies base (>=4.7 && <5), deepseq, ghc (>=8.2.1), mtl (<2.3), process, split, temporary [details]
License BSD-3-Clause
Copyright FP Complete
Author Chris Done
Maintainer chrisdone@fpcomplete.com
Revised Revision 1 made by sjakobi at 2022-05-23T11:03:17Z
Category Web
Home page https://github.com/fpco/weigh#readme
Uploaded by ChrisDone at 2019-12-01T18:31:38Z
Distributions Arch:0.0.16, Debian:0.0.16, LTSHaskell:0.0.16, NixOS:0.0.16, Stackage:0.0.16
Downloads 11939 total (99 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 2019-12-01 [all 1 reports]

Readme for weigh-0.0.16

[back to package description]

weigh Build Status

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.