Just run the measuring and print a report. Uses weighResults.
Moduleweigh-0.0.18Haskell2010
Weigh
Framework for seeing how much a function allocates.
WARNING: weigh is incompatible with profiling. It reports much more allocations with profiling turned on.
Example:
import Weigh
main =
mainWith (do func "integers count 0" count 0
func "integers count 1" count 1
func "integers count 2" count 2
func "integers count 3" count 3
func "integers count 10" count 10
func "integers count 100" count 100)
where count :: Integer -> ()
count 0 = ()
count a = count (a - 1)
Use wgroup to group sets of tests.
- 6 types
- 22 values
- Packageweigh-0.0.18
- Exports28
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceWeigh.hs
Main entry points
2 declarationsRun the measuring and return all the results, each one may have an error.
Configuration
7 declarationsSet the columns to display in the config
Table column.
Constructors
CaseCase name for the column
AllocatedTotal bytes allocated
GCsTotal number of GCs
LiveTotal amount of live data in the heap
CheckTable column indicating about the test status
MaxMaximum residency memory in use
MaxOSMaximum memory in use by the RTS. Valid only for GHC >= 8.2.2. For unsupported GHC, this is reported as 0.
WallTimeRough execution time. For general indication, not a benchmark tool.
Set the output format in the config
Set the config. Default is: defaultConfig.
Weigh configuration.
Constructors
Default config.
Simple combinators
6 declarationsfunc Weigh a function applied to an argument.
Implemented in terms of validateFunc.
Weigh a function applied to an argument. Unlike func, the argument is evaluated to normal form before the function is applied.
io Weigh an action applied to an argument.
Implemented in terms of validateAction.
Weigh a value.
Implemented in terms of action.
Weigh an IO action.
Implemented in terms of validateAction.
Make a grouping of tests.
Validating combinators
2 declarationsvalidateAction Weigh an IO action, validating the result.
validateFunc Weigh a function, validating the result
Validators
1 declarationMake a validator that set sthe maximum allocations.
Types
2 declarationsWeigh specification monad.
How much a computation weighed in at.
Constructors
Handy utilities
2 declarationsFormatting an integral number to 1,000,000, etc.
Internals
6 declarationsweighDispatch Weigh a set of actions. The value of the actions are forced completely to ensure they are fully allocated.
weighFunc Weigh a pure function. This function is built on top of weighFuncResult, which is heavily documented inside
weighFuncResult Weigh a pure function and return the result. This function is heavily documented inside.
weighAction Weigh an IO action. This function is based on weighActionResult, which is heavily documented inside.
weighActionResult Weigh an IO action, and return the result. This function is heavily documented inside.
Instances8Functor, Foldable, Traversable, Eq, Show, Generic, …
Functor GroupedDefined in weigh-0.0.18 · WeighFoldable GroupedDefined in weigh-0.0.18 · WeighTraversable GroupedDefined in weigh-0.0.18 · WeighEq a => Eq (Grouped a)Defined in weigh-0.0.18 · WeighShow a => Show (Grouped a)Defined in weigh-0.0.18 · WeighGeneric (Grouped a)Defined in weigh-0.0.18 · WeighNFData a => NFData (Grouped a)Defined in weigh-0.0.18 · Weightype Rep (Grouped a) = D1 ('MetaDataDefined in weigh-0.0.18 · Weigh"Grouped"
"Weigh"
"weigh-0.0.18-B5xb3b4ujgSF7b7acxKit3"
'False) (C1 ('MetaCons"Grouped"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Grouped a])) :+: C1 ('MetaCons"Singleton"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))