An aspect is a piece of data obtained from running a benchmark, like its total runtime, heap usage, or executable size. Aspects have physical units, so runtime is in seconds, and executable size is in bytes. The type system ensures that you can't mess up the units, such as by treating executable size as though it was measured in seconds.
Aspects are also parameterised over a carrier constructor, which is the collection type
used to store the data. For single valued data use the
Single constructor. For multi valued
data use the
 (the list constructor). Use this when you have several readings for
the same benchmark, like runtimes from multiple independent runs.
Other useful constructors are
Once you have a many-valued aspect, you can use
makeAspectStats to compute statistics
from the data.
Here is a worked example:
-- This is our original, single valued data. someData :: [
Single)] someData = [
secs` 100 ,
secs` 85 ,
bytes` 1024 ,
bytes` 100000 ,
-- Collate the data, which groups all the readings for the same aspect into a list. -- Note that the carrier constructor is now . collated :: [
Aspect)] collated =
collateWithUnitssomeData ... show collated => [
-- Extract statistics from the collated data. analysed :: [
Stats)] analysed = map (
makeAspectStats) collated ... show analysed => [
- module BuildBox.Aspect.Units
- module BuildBox.Aspect.Detail
- module BuildBox.Aspect.Stats
- module BuildBox.Aspect.Single
- module BuildBox.Aspect.Comparison
- data Aspect c units where
- makeAspect :: HasUnits (c units) units => Detail -> c units -> Maybe (Aspect c units)
- splitAspect :: Aspect c units -> (Detail, c units)
- makeAspectStats :: Aspect  units -> Aspect Stats units
- makeAspectComparison :: Real units => [Aspect Stats units] -> Aspect Stats units -> Aspect StatsComparison units
- makeAspectComparisons :: Real units => [Aspect Stats units] -> [Aspect Stats units] -> [Aspect StatsComparison units]
- appAspect :: Real units => (c units -> b) -> Aspect c units -> b
- appAspectWithUnits :: (forall units. Real units => c units -> b) -> WithUnits (Aspect c) -> b
- liftAspect :: (c1 units -> c2 units) -> Aspect c1 units -> Aspect c2 units
- liftAspect2 :: (c1 units -> c1 units -> c2 units) -> Aspect c1 units -> Aspect c1 units -> Aspect c2 units
Holds a detail about a benchmark.
c is the type constructor of the carrier that holds the data.
|Time :: Timed -> c Seconds -> Aspect c Seconds|
|Size :: Sized -> c Bytes -> Aspect c Bytes|
|Used :: Used -> c Bytes -> Aspect c Bytes|
Make an aspect from a named detail and data.
If the detail doesn't match the units of the data then
Split an aspect into its named detail and data.
Statistics and comparisons
Compute statistics for many-valued aspects.
Lookup the baseline result for some aspect and produce a comparison.
Compare lists of aspects. The first argument is the baseline.
Apply a function to the data in an aspect
Apply a function to the data in a wrapped aspect.
Transform the data in an aspect, possibly changing the carrier type.