weigh: Measure allocations of a Haskell functions/values

[ bsd3, web ] [ Propose Tags ] [ Report a vulnerability ]

Please see README.md


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

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, 0.0.17, 0.0.18 (info)
Change log CHANGELOG
Dependencies base (>=4.7 && <5), criterion-measurement, deepseq, mtl, process, split, temporary [details]
License BSD-3-Clause
Copyright FP Complete
Author Chris Done
Maintainer chrisdone@fpcomplete.com
Category Web
Home page https://github.com/fpco/weigh#readme
Uploaded by psibi at 2024-11-01T15:57:20Z
Distributions Arch:0.0.17, Debian:0.0.16, LTSHaskell:0.0.18, NixOS:0.0.17, Stackage:0.0.18
Reverse Dependencies 3 direct, 1 indirect [details]
Downloads 13932 total (140 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 2024-11-01 [all 1 reports]

Readme for weigh-0.0.18

[back to package description]

weigh Tests

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.