-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Performance methods and monad. -- -- A set of tools to measure performance of Haskell programs. See the -- Perf module and readme for an example and full API documentation. @package perf @version 0.14.0.1 -- | Order of complexity) calculations. module Perf.BigO -- | order type data O -- | cubic N3 :: O -- | quadratic N2 :: O -- | ^3/2 N32 :: O -- | N * log N NLogN :: O -- | linear N1 :: O -- | sqrt N N12 :: O -- | log N LogN :: O -- | constant N0 :: O -- | enumeration of O types -- --
--   >>> olist
--   [N3,N2,N32,NLogN,N1,N12,LogN,N0]
--   
olist :: [O] -- | Calculate the expected performance measure -- --
--   >>> promote (order N2 1) 10
--   100.0
--   
promote :: Order Double -> Double -> Double -- | Calculate the expected performance measure per n -- --
--   >>> promote (order N2 1) 10
--   100.0
--   
promote1 :: Order Double -> Double -- | functions to compute performance measure -- --
--   >>> fmap ($ 0) promote_
--   [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
--   
-- --
--   >>> fmap ($ 1) promote_
--   [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]
--   
-- -- Ordering makes sense around N=10 -- --
--   >>> fmap ($ 10) promote_
--   [1000.0,100.0,31.622776601683793,23.02585092994046,10.0,3.1622776601683795,2.302585092994046,1.0]
--   
-- -- Having NP may cause big num problems -- --
--   >>> fmap ($ 1000) promote_
--   [1.0e9,1000000.0,31622.776601683792,6907.755278982137,1000.0,31.622776601683793,6.907755278982137,1.0]
--   
promote_ :: [Double -> Double] -- | Calculate an Order from a given O, an n, and a total performance -- measurement -- -- A measurement of 1e6 for n=1000 with an order of N2 is: -- --
--   >>> demote N2 1000 1000000
--   Order {factors = [0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0]}
--   
-- --
--   promote (demote N2 n m) n m == m
--   
demote :: O -> Double -> Double -> Order Double -- | Calculate an Order from a measure, and an O -- --
--   >>> demote1 N2 1000
--   Order {factors = [0.0,1000.0,0.0,0.0,0.0,0.0,0.0,0.0]}
--   
-- --
--   demote1 N2 m == demote o 1 m
--   
demote1 :: O -> Double -> Order Double -- | The factor for each O given an n, and a measurement. -- --
--   >>> spectrum 100 10000
--   Order {factors = [1.0e-2,1.0,10.0,21.71472409516259,100.0,1000.0,2171.4724095162587,10000.0]}
--   
spectrum :: Double -> Double -> Order Double -- | a set of factors for each order, which represents a full Order -- specification. newtype Order a Order :: [a] -> Order a [factors] :: Order a -> [a] -- | find the dominant order, and it's factor -- --
--   >>> bigO o
--   (N2,1.0)
--   
bigO :: (Ord a, Num a) => Order a -> (O, a) -- | compute the runtime component of an Order, defined as the difference -- between the dominant order and the total for a single run. -- --
--   >>> runtime o
--   100.0
--   
runtime :: Order Double -> Double -- | A set of factors consisting of the dominant order, the dominant order -- factor and a constant factor data BigOrder a BigOrder :: O -> a -> BigOrder a [bigOrder] :: BigOrder a -> O [bigFactor] :: BigOrder a -> a -- | compute the BigOrder -- --
--   >>> fromOrder o
--   BigOrder {bigOrder = N2, bigFactor = 1.0}
--   
fromOrder :: Order Double -> BigOrder Double -- | convert a BigOrder to an Order. -- -- toOrder . fromOrder is not a round trip iso. -- --
--   >>> toOrder (fromOrder o)
--   Order {factors = [0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0]}
--   
toOrder :: BigOrder Double -> Order Double -- | create an Order -- --
--   >>> order N2 1
--   Order {factors = [0,1,0,0,0,0,0,0]}
--   
order :: Num a => O -> a -> Order a -- | The errors for a list of n's and measurements, based on the spectrum -- of the last measurement. diffs :: [Double] -> [Double] -> [[Double]] -- | minimum error order for a list of measurements -- --
--   >>> bestO ns ms
--   N1
--   
bestO :: [Double] -> [Double] -> O -- | fit the best order for the last measurement and return it, and the -- error terms for the measurements -- --
--   >>> estO ns ms
--   (Order {factors = [0.0,0.0,0.0,0.0,102.90746947660953,0.0,0.0,0.0]},[2702.0925305233905,2446.9253052339045,-301.7469476609531,-10317.469476609534,0.0])
--   
estO :: [Double] -> [Double] -> (Order Double, [Double]) -- | fit orders from the last measurement to the first, using the residuals -- at each step. -- --
--   >>> estOs ns ms
--   [Order {factors = [0.0,0.0,0.0,0.0,102.90746947660953,0.0,0.0,0.0]},Order {factors = [0.0,0.0,-0.32626703235351473,0.0,0.0,0.0,0.0,0.0]},Order {factors = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,24.520084692561625]},Order {factors = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,2432.722690017952]},Order {factors = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,245.1760228452299]}]
--   
estOs :: [Double] -> [Double] -> [Order Double] makeNs :: Int -> Double -> Int -> [Int] data OrderOptions OrderOptions :: Bool -> Int -> Double -> OrderOptions [doOrder] :: OrderOptions -> Bool [orderLow] :: OrderOptions -> Int [orderDivisor] :: OrderOptions -> Double defaultOrderOptions :: OrderOptions parseOrderOptions :: OrderOptions -> Parser OrderOptions instance GHC.Enum.Enum Perf.BigO.O instance GHC.Generics.Generic Perf.BigO.O instance GHC.Show.Show Perf.BigO.O instance GHC.Classes.Ord Perf.BigO.O instance GHC.Classes.Eq Perf.BigO.O instance GHC.Base.Functor Perf.BigO.Order instance GHC.Generics.Generic (Perf.BigO.Order a) instance GHC.Show.Show a => GHC.Show.Show (Perf.BigO.Order a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Perf.BigO.Order a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Perf.BigO.Order a) instance GHC.Base.Functor Perf.BigO.BigOrder instance GHC.Generics.Generic (Perf.BigO.BigOrder a) instance GHC.Show.Show a => GHC.Show.Show (Perf.BigO.BigOrder a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Perf.BigO.BigOrder a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Perf.BigO.BigOrder a) instance GHC.Generics.Generic Perf.BigO.OrderOptions instance GHC.Show.Show Perf.BigO.OrderOptions instance GHC.Classes.Eq Perf.BigO.OrderOptions instance Prettyprinter.Internal.Pretty (Perf.BigO.BigOrder GHC.Types.Double) instance GHC.Num.Num a => GHC.Num.Num (Perf.BigO.Order a) -- | Statistical choices for multiple performance measurements. module Perf.Stats -- | Compute the average average :: [Double] -> Double -- | Compute the median median :: [Double] -> Double -- | Compute the tenth percentile tenth :: [Double] -> Double -- | Compute the average of an Integral averageI :: Integral a => [a] -> Double -- | Command-line options for type of statistic. data StatDType StatAverage :: StatDType StatMedian :: StatDType StatBest :: StatDType -- | Compute a statistic. statD :: StatDType -> [Double] -> Double -- | Compute a list of statistics. statDs :: StatDType -> [[Double]] -> [Double] -- | Parse command-line StatDType options. parseStatD :: Parser StatDType -- | Add a statistic to a State Map addStat :: (Ord k, Monad m) => k -> s -> StateT (Map k s) m () -- | Linguistic conversion of an ordinal ordy :: Int -> [Text] -- | Compute all stats. allStats :: Int -> Map [Text] [[Double]] -> Map [Text] [Double] -- | Convert a Map of performance result to a statistic. statify :: Ord a => StatDType -> Map a [[Double]] -> Map [a] [Double] instance GHC.Show.Show Perf.Stats.StatDType instance GHC.Classes.Eq Perf.Stats.StatDType module Perf.Chart data PerfChartOptions PerfChartOptions :: Bool -> FilePath -> Double -> Bool -> Bool -> Bool -> Bool -> Style -> Int -> LegendOptions -> Style -> HudOptions -> Style -> HudOptions -> Double -> Int -> Double -> Bool -> PerfChartOptions [doChart] :: PerfChartOptions -> Bool [chartFilepath] :: PerfChartOptions -> FilePath [truncateAt] :: PerfChartOptions -> Double [doSmallChart] :: PerfChartOptions -> Bool [doBigChart] :: PerfChartOptions -> Bool [doHistChart] :: PerfChartOptions -> Bool [doAveragesLegend] :: PerfChartOptions -> Bool [averagesStyle] :: PerfChartOptions -> Style [averagesPaletteStart] :: PerfChartOptions -> Int [averagesLegend] :: PerfChartOptions -> LegendOptions [smallStyle] :: PerfChartOptions -> Style [smallHud] :: PerfChartOptions -> HudOptions [bigStyle] :: PerfChartOptions -> Style [bigHud] :: PerfChartOptions -> HudOptions [titleSize] :: PerfChartOptions -> Double [histGrain] :: PerfChartOptions -> Int [bigWidth] :: PerfChartOptions -> Double [excludeZeros] :: PerfChartOptions -> Bool defaultPerfChartOptions :: PerfChartOptions -- | Parse charting options. parsePerfChartOptions :: PerfChartOptions -> Parser PerfChartOptions perfCharts :: PerfChartOptions -> Maybe [Text] -> Map Text [[Double]] -> ChartOptions perfChart :: PerfChartOptions -> Text -> [Double] -> ChartOptions dotHistChart :: Int -> Style -> ChartOptions -> [Point Double] -> (ChartOptions, ChartOptions) compareCharts :: [(PerfChartOptions, Text, [Double])] -> ChartOptions dotHistCharts :: Int -> ChartOptions -> [(Style, [Point Double])] -> (ChartOptions, ChartOptions) instance GHC.Generics.Generic Perf.Chart.PerfChartOptions instance GHC.Show.Show Perf.Chart.PerfChartOptions instance GHC.Classes.Eq Perf.Chart.PerfChartOptions -- | Abstract types of performance measurement. module Perf.Types -- | Abstraction of a performance measurement within a monadic context. -- -- newtype Measure m t Measure :: (forall a b. (a -> b) -> a -> m (t, b)) -> Measure m t [measure] :: Measure m t -> forall a b. (a -> b) -> a -> m (t, b) -- | Convert a Measure into a multi measure. repeated :: Applicative m => Int -> Measure m t -> Measure m [t] -- | Abstraction of a performance measurement with a pre and a post step -- wrapping the computation. data StepMeasure m t StepMeasure :: m i -> (i -> m t) -> StepMeasure m t [pre] :: StepMeasure m t -> m i [post] :: StepMeasure m t -> i -> m t -- | Convert a StepMeasure into a Measure toMeasure :: Monad m => StepMeasure m t -> Measure m t -- | Convert a StepMeasure into a Measure running the computation multiple -- times. toMeasureN :: Monad m => Int -> StepMeasure m t -> Measure m [t] -- | A single step measurement. step :: Monad m => m i -> (i -> m t) -> (a -> b) -> a -> m (t, b) -- | A single step measurement. stepM :: Monad m => m i -> (i -> m t) -> m a -> m (t, a) -- | Return one result but multiple measurements. multi :: Monad m => ((a -> b) -> a -> m (t, b)) -> Int -> (a -> b) -> a -> m ([t], b) -- | Multiple measurements multiM :: Monad m => (m a -> m (t, a)) -> Int -> m a -> m ([t], a) multiN :: (b -> t) -> (a -> b) -> a -> Int -> IO t -- | Lift an application to a PerfT m, providing a label and a -- Measure. -- -- Measurements with the same label will be mappended fap :: (MonadIO m, Semigroup t) => Text -> (a -> b) -> a -> PerfT m t b -- | Lift an application to a PerfT m, forcing the argument. afap :: (NFData a, MonadIO m, Semigroup t) => Text -> (a -> b) -> a -> PerfT m t b -- | Lift an application to a PerfT m, forcing argument and result. ffap :: (NFData a, NFData b, MonadIO m, Semigroup t) => Text -> (a -> b) -> a -> PerfT m t b -- | Lift a number to a PerfT m, providing a label, function, and input. -- -- Measurements with the same label will be added fan :: (MonadIO m, Num t) => Text -> (a -> b) -> a -> PerfT m t b -- | Lift a monadic value to a PerfT m, providing a label and a -- Measure. -- -- Measurements with the same label will be added fam :: (MonadIO m, Semigroup t) => Text -> m a -> PerfT m t a -- | lift a pure, unnamed function application to PerfT (|$|) :: Semigroup t => (a -> b) -> a -> PerfT IO t b -- | lift a monadic, unnamed function application to PerfT ($|) :: Semigroup t => IO a -> PerfT IO t a -- | lift an unnamed numeric measure to PerfT (|+|) :: Num t => (a -> b) -> a -> PerfT IO t b -- | Performance measurement transformer storing a Measure and a map -- of named results. newtype PerfT m t a PerfT :: StateT (Measure m t, Map Text t) m a -> PerfT m t a [measurePerf] :: PerfT m t a -> StateT (Measure m t, Map Text t) m a -- | The transformer over Identity type Perf t a = PerfT Identity t a -- | Run the performance measure, returning (computational result, -- measurement). runPerfT :: Functor m => Measure m t -> PerfT m t a -> m (a, Map Text t) -- | Consume the PerfT layer and return the original monadic result. -- Fingers crossed, PerfT structure should be completely compiled away. evalPerfT :: Monad m => Measure m t -> PerfT m t a -> m a -- | Consume a PerfT layer and return the measurement. execPerfT :: Monad m => Measure m t -> PerfT m t a -> m (Map Text t) -- | run a PerfT and also calculate performance over the entire computation outer :: (MonadIO m, Semigroup s) => Text -> Measure m s -> Measure m t -> PerfT m t a -> m (a, (Map Text s, Map Text t)) -- | run a PerfT and calculate excess performance over the entire -- computation slop :: (MonadIO m, Num t, Semigroup t) => Text -> Measure m t -> PerfT m t a -> m (a, Map Text t) -- | run a multi PerfT and calculate excess performance over the entire -- computation slops :: (MonadIO m, Num t, Semigroup t) => Int -> Measure m t -> PerfT m [t] a -> m (a, (Map Text t, Map Text [t])) instance GHC.Base.Monad m => GHC.Base.Monad (Perf.Types.PerfT m t) instance GHC.Base.Monad m => GHC.Base.Applicative (Perf.Types.PerfT m t) instance GHC.Base.Functor m => GHC.Base.Functor (Perf.Types.PerfT m t) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Perf.Types.PerfT m t) instance GHC.Base.Functor m => GHC.Base.Functor (Perf.Types.StepMeasure m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Perf.Types.StepMeasure m) instance GHC.Base.Functor m => GHC.Base.Functor (Perf.Types.Measure m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Perf.Types.Measure m) -- | Use of Clock from the clock library to measure time -- performance of a computation. module Perf.Time -- | A performance measure of number of nanoseconds. type Nanos = Integer -- | MonotonicRaw is the default for macOS & linux, at around 42 -- nano time resolution, and a tick_ measurement of around 170 -- nanos. For Windows, ThreadCPUTime has a similar time resolution -- at 42 nanos and a tick_ of around 500 nanos. defaultClock :: Clock -- | Convert Nanos to seconds. toSecs :: Nanos -> Double -- | A single reading of a specific Clock. nanosWith :: Clock -> IO Nanos -- | A single defaultClock reading (note that the absolute value is -- not meaningful). nanos :: IO Nanos -- | tick_ measures the number of nanos it takes to read the clock. tick_ :: IO Nanos -- | Warm up the clock, to avoid a high first measurement. Without a -- warmup, one or more larger values can occur at the start of a -- measurement spree, and often are in the zone of an L2 miss. warmup :: Int -> IO () -- | tick from a specific Clock tickWith :: Clock -> (a -> b) -> a -> IO (Nanos, b) -- | tick f a -- -- tick :: (a -> b) -> a -> IO (Nanos, b) -- | tickWHNF f a -- -- tickWHNF :: (a -> b) -> a -> IO (Nanos, b) -- | tickLazy f a -- -- tickLazy :: (a -> b) -> a -> IO (Nanos, b) -- | tickForce f a -- -- tickForce :: (NFData a, NFData b) => (a -> b) -> a -> IO (Nanos, b) -- | tickForceArgs f a -- -- tickForceArgs :: NFData a => (a -> b) -> a -> IO (Nanos, b) -- | measures an IO a tickIO :: IO a -> IO (Nanos, a) -- | measures an IO a tickIOWith :: Clock -> IO a -> IO (Nanos, a) -- | n measurements of a tick -- -- returns a list of Nanos and the last evaluated f a ticks :: Int -> (a -> b) -> a -> IO ([Nanos], b) -- | n measurements of a tickIO -- -- returns an IO tuple; list of Nanos and the last evaluated f a ticksIO :: Int -> IO a -> IO ([Nanos], a) -- | tick as a Measure time :: Measure IO Nanos -- | tick as a multi-Measure times :: Int -> Measure IO [Nanos] -- | tickWith as a multi-Measure timesWith :: Clock -> Int -> Measure IO [Nanos] -- | tickWith for n repeated applications timesN :: Int -> Measure IO Nanos -- | tickWith for n repeated applications timesNWith :: Clock -> Int -> Measure IO Nanos -- | tick as a StepMeasure stepTime :: StepMeasure IO Nanos -- | Space performance measurement. module Perf.Space -- | GHC allocation statistics. data SpaceStats SpaceStats :: Word64 -> Word64 -> Word64 -> Word32 -> Word32 -> SpaceStats [allocated] :: SpaceStats -> Word64 [copied] :: SpaceStats -> Word64 [maxmem] :: SpaceStats -> Word64 [minorgcs] :: SpaceStats -> Word32 [majorgcs] :: SpaceStats -> Word32 -- | Convert SpaceStats to a list of numbers. ssToList :: Num a => SpaceStats -> [a] -- | Labels for SpaceStats. spaceLabels :: [Text] -- | A allocation StepMeasure with a flag to determine if -- performGC should run prior to the measurement. space :: Bool -> StepMeasure IO SpaceStats -- | Measure memory allocation, with a flag to run performGC prior -- to the measurement. allocation :: Bool -> StepMeasure IO Bytes -- | Number of bytes newtype Bytes Bytes :: Word64 -> Bytes [unbytes] :: Bytes -> Word64 instance GHC.Classes.Eq Perf.Space.SpaceStats instance GHC.Show.Show Perf.Space.SpaceStats instance GHC.Read.Read Perf.Space.SpaceStats instance GHC.Real.Integral Perf.Space.Bytes instance GHC.Enum.Enum Perf.Space.Bytes instance GHC.Real.Real Perf.Space.Bytes instance GHC.Num.Num Perf.Space.Bytes instance GHC.Classes.Ord Perf.Space.Bytes instance GHC.Classes.Eq Perf.Space.Bytes instance GHC.Read.Read Perf.Space.Bytes instance GHC.Show.Show Perf.Space.Bytes instance GHC.Base.Semigroup Perf.Space.Bytes instance GHC.Base.Monoid Perf.Space.Bytes instance GHC.Base.Semigroup Perf.Space.SpaceStats instance GHC.Base.Monoid Perf.Space.SpaceStats instance GHC.Num.Num Perf.Space.SpaceStats -- | Simple counter. module Perf.Count -- | Register 1 as a performance measure count :: Applicative m => StepMeasure m Int -- | Count the number of times measured. countN :: Int -> Measure IO Int -- | Unification of the various different performance measure types, mostly -- to unify reporting and data management. module Perf.Measure -- | Command-line measurement options. data MeasureType MeasureTime :: MeasureType MeasureNTime :: MeasureType MeasureSpace :: MeasureType MeasureSpaceTime :: MeasureType MeasureAllocation :: MeasureType MeasureCount :: MeasureType -- | Parse command-line MeasureType options. parseMeasure :: Parser MeasureType -- | unification of the different measurements to being a list of doubles. measureDs :: MeasureType -> Clock -> Int -> Measure IO [[Double]] -- | unification of measurement labels measureLabels :: MeasureType -> [Text] -- | How to fold the list of performance measures. measureFinalStat :: MeasureType -> Int -> [Double] -> Double instance GHC.Show.Show Perf.Measure.MeasureType instance GHC.Classes.Eq Perf.Measure.MeasureType -- | Algorithms and functions for testing purposes module Perf.Algos -- | Algorithm examples for testing data Example ExampleSumFuse :: Example ExampleSum :: Example ExampleLengthF :: Example ExampleConstFuse :: Example ExampleMapInc :: Example ExampleNoOp :: Example ExampleNub :: Example ExampleFib :: Example -- | Parse command-line options for algorithm examples. parseExample :: Parser Example -- | Unification of example function applications data ExamplePattern a PatternSumFuse :: Text -> (Num a => a -> a) -> a -> ExamplePattern a PatternSum :: Text -> (Num a => [a] -> a) -> [a] -> ExamplePattern a PatternLengthF :: Text -> ([a] -> Int) -> [a] -> ExamplePattern a PatternConstFuse :: Text -> (Int -> ()) -> Int -> ExamplePattern a PatternMapInc :: Text -> ([Int] -> [Int]) -> [Int] -> ExamplePattern a PatternNoOp :: Text -> (() -> ()) -> () -> ExamplePattern a PatternNub :: Text -> ([Int] -> [Int]) -> [Int] -> ExamplePattern a PatternFib :: Text -> (Int -> Integer) -> Int -> ExamplePattern a -- | Convert an Example to an ExamplePattern. examplePattern :: Example -> Int -> ExamplePattern Int -- | Labels exampleLabel :: ExamplePattern a -> Text -- | Convert an ExamplePattern to a PerfT. testExample :: (Semigroup a, MonadIO m) => ExamplePattern Int -> PerfT m a () -- | Convert an ExamplePattern to a tasty-bench run. tastyExample :: ExamplePattern Int -> Benchmarkable -- | Unification of sum function applications data SumPattern a SumFuse :: Text -> (Int -> Int) -> Int -> SumPattern a SumFusePoly :: Text -> ((Enum a, Num a) => a -> a) -> a -> SumPattern a SumPoly :: Text -> (Num a => [a] -> a) -> [a] -> SumPattern a SumMono :: Text -> ([Int] -> Int) -> [Int] -> SumPattern a -- | All the sum algorithms. allSums :: Int -> [SumPattern Int] -- | Convert an SumPattern to a PerfT. testSum :: (Semigroup a, MonadIO m) => SumPattern Int -> PerfT m a Int -- | Run a sum algorithm measurement. statSums :: MonadIO m => Int -> Int -> (Int -> Measure m [a]) -> m (Map Text [a]) -- | tail resursive sumTail :: Num a => [a] -> a -- | lazy recursion. sumTailLazy :: Num a => [a] -> a -- | With argument order flipped sumFlip :: Num a => [a] -> a -- | Lazy with argument order flipped. sumFlipLazy :: Num a => [a] -> a -- | Co-routine style sumCo :: Num a => [a] -> a -- | Co-routine, go style sumCoGo :: Num a => [a] -> a -- | Co-routine, case-style sumCoCase :: Num a => [a] -> a -- | Auxillary style. sumAux :: Num a => [a] -> a -- | foldr style sumFoldr :: Num a => [a] -> a -- | cata style sumCata :: Num a => [a] -> a -- | sum sumSum :: Num a => [a] -> a -- | Monomorphic sum sumMono :: [Int] -> Int -- | Polymorphic sum sumPoly :: Num a => [a] -> a -- | Lambda-style sum sumLambda :: Num a => [a] -> a -- | GHC-style foldr method. sumF :: Num a => [a] -> a -- | Fusion check sumFuse :: Int -> Int -- | Fusion under polymorph sumFusePoly :: (Enum a, Num a) => a -> a -- | foldl' fusion sumFuseFoldl' :: Int -> Int -- | foldr fusion sumFuseFoldr :: Int -> Int -- | Unification of length function applications data LengthPattern a LengthPoly :: Text -> ([a] -> Int) -> [a] -> LengthPattern a LengthMono :: Text -> ([Int] -> Int) -> [Int] -> LengthPattern a -- | All the length algorithms. allLengths :: Int -> [LengthPattern Int] -- | Convert an LengthPattern to a PerfT. testLength :: (Semigroup a, MonadIO m) => LengthPattern Int -> PerfT m a Int -- | Run a lengths algorithm statLengths :: MonadIO m => Int -> Int -> (Int -> Measure m [a]) -> m (Map Text [a]) -- | tail resursive lengthTail :: [a] -> Int -- | lazy recursion. lengthTailLazy :: [a] -> Int -- | With argument order flipped lengthFlip :: [a] -> Int -- | Lazy with argument order flipped. lengthFlipLazy :: [a] -> Int -- | Co-routine style lengthCo :: [a] -> Int -- | Co-routine style as a Case statement. lengthCoCase :: [a] -> Int -- | Auxillary version. lengthAux :: [a] -> Int -- | foldr style lengthFoldr :: [a] -> Int -- | foldr style with explicit const usage. lengthFoldrConst :: [a] -> Int -- | GHC style lengthF :: [a] -> Int -- | Monomorphic, GHC style lengthFMono :: [Int] -> Int -- | Tail recursion recurseTail :: (a -> b -> b) -> b -> [a] -> b -- | Lazy tail recursion recurseTailLazy :: (a -> b -> b) -> b -> [a] -> b -- | Tail resursion with flipped argument order. recurseFlip :: (a -> b -> b) -> b -> [a] -> b -- | Lazy tail resursion with flipped argument order. recurseFlipLazy :: (a -> b -> b) -> b -> [a] -> b -- | Coroutine recurseCo :: (a -> b -> b) -> b -> [a] -> b -- | Lazy, coroutine recurseCoLazy :: (a -> b -> b) -> b -> [a] -> b -- | Cata style recurseCata :: (a -> b -> b) -> b -> [a] -> b -- | Increment a list. mapInc :: [Int] -> [Int] -- | Test of const fusion constFuse :: Int -> () -- | Split a list. splitHalf :: [a] -> ([a], [a]) instance GHC.Show.Show Perf.Algos.Example instance GHC.Classes.Eq Perf.Algos.Example -- | Reporting on performance, potentially checking versus a canned -- results. module Perf.Report -- | Benchmark name type Name = String -- | Whether to include header information. data Header Header :: Header NoHeader :: Header -- | Command-line parser for Header parseHeader :: Parser Header -- | Levels of geometric difference in compared performance that triggers -- reporting. data CompareLevels CompareLevels :: Double -> Double -> Double -> CompareLevels [errorLevel] :: CompareLevels -> Double [warningLevel] :: CompareLevels -> Double [improvedLevel] :: CompareLevels -> Double -- |
--   >>> defaultCompareLevels
--   CompareLevels {errorLevel = 0.2, warningLevel = 5.0e-2, improvedLevel = 5.0e-2}
--   
defaultCompareLevels :: CompareLevels -- | Command-line parser for CompareLevels parseCompareLevels :: CompareLevels -> Parser CompareLevels -- | Options for production of a performance report. data ReportOptions ReportOptions :: Int -> Int -> Clock -> StatDType -> MeasureType -> Golden -> Header -> CompareLevels -> PerfChartOptions -> PerfDumpOptions -> Bool -> OrderOptions -> Bool -> ReportOptions -- | Number of times to run a benchmark. [reportN] :: ReportOptions -> Int [reportLength] :: ReportOptions -> Int [reportClock] :: ReportOptions -> Clock [reportStatDType] :: ReportOptions -> StatDType [reportMeasureType] :: ReportOptions -> MeasureType [reportGolden] :: ReportOptions -> Golden [reportHeader] :: ReportOptions -> Header [reportCompare] :: ReportOptions -> CompareLevels [reportChart] :: ReportOptions -> PerfChartOptions [reportDump] :: ReportOptions -> PerfDumpOptions [reportGC] :: ReportOptions -> Bool [reportOrder] :: ReportOptions -> OrderOptions [reportTasty] :: ReportOptions -> Bool -- | Default reporting options defaultReportOptions :: ReportOptions -- | Command-line parser for ReportOptions parseReportOptions :: ReportOptions -> Parser ReportOptions data PerfDumpOptions PerfDumpOptions :: FilePath -> Bool -> PerfDumpOptions [dumpFilepath] :: PerfDumpOptions -> FilePath [doDump] :: PerfDumpOptions -> Bool defaultPerfDumpOptions :: PerfDumpOptions -- | Parse charting options. parsePerfDumpOptions :: PerfDumpOptions -> Parser PerfDumpOptions fromDump :: PerfDumpOptions -> IO (Map Text [[Double]]) -- | Report results -- -- If a goldenFile is checked, and performance has degraded, the function -- will exit with ExitFailure so that 'cabal bench' and other -- types of processes can signal performance issues. report :: ReportOptions -> Map [Text] [Double] -> IO () -- | Run and report a benchmark with the specified reporting options. reportMain :: Example -> ReportOptions -> Name -> (Int -> PerfT IO [[Double]] a) -> IO a -- | Write results to file writeResult :: FilePath -> Map [Text] Double -> IO () -- | Read results from a file. readResult :: FilePath -> IO (Either String (Map [Text] Double)) -- | Comparison data between two results. data CompareResult CompareResult :: Maybe Double -> Maybe Double -> Text -> CompareResult [oldResult] :: CompareResult -> Maybe Double [newResult] :: CompareResult -> Maybe Double [noteResult] :: CompareResult -> Text -- | Compare two results and produce some notes given level triggers. compareNote :: Ord a => CompareLevels -> Map a Double -> Map a Double -> Map a CompareResult -- | Format a result as a table. report2D :: Map [Text] Double -> IO () -- | Golden file options. data Golden Golden :: FilePath -> CheckGolden -> RecordGolden -> Golden [golden] :: Golden -> FilePath [check] :: Golden -> CheckGolden [record] :: Golden -> RecordGolden -- | Default is Golden "other/bench.perf" CheckGolden NoRecordGolden defaultGolden :: Golden -- | Parse command-line golden file options. parseGolden :: Parser Golden -- | Replace the Golden file path with the suggested stem, but only if the -- user did not specify a specific file path at the command line. replaceDefaultFilePath :: FilePath -> ReportOptions -> ReportOptions -- | Parse command-line Clock options. parseClock :: Parser Clock reportToConsole :: [Text] -> IO () instance GHC.Generics.Generic Perf.Report.Header instance GHC.Show.Show Perf.Report.Header instance GHC.Classes.Eq Perf.Report.Header instance GHC.Generics.Generic Perf.Report.PerfDumpOptions instance GHC.Show.Show Perf.Report.PerfDumpOptions instance GHC.Classes.Eq Perf.Report.PerfDumpOptions instance GHC.Show.Show Perf.Report.CompareLevels instance GHC.Classes.Eq Perf.Report.CompareLevels instance GHC.Classes.Eq Perf.Report.CompareResult instance GHC.Show.Show Perf.Report.CompareResult instance GHC.Generics.Generic Perf.Report.CheckGolden instance GHC.Show.Show Perf.Report.CheckGolden instance GHC.Classes.Eq Perf.Report.CheckGolden instance GHC.Generics.Generic Perf.Report.RecordGolden instance GHC.Show.Show Perf.Report.RecordGolden instance GHC.Classes.Eq Perf.Report.RecordGolden instance GHC.Show.Show Perf.Report.Golden instance GHC.Classes.Eq Perf.Report.Golden instance GHC.Generics.Generic Perf.Report.Golden instance GHC.Generics.Generic Perf.Report.ReportOptions instance GHC.Show.Show Perf.Report.ReportOptions instance GHC.Classes.Eq Perf.Report.ReportOptions -- |

Introduction

-- -- perf provides tools for measuring the runtime performance of -- Haskell functions. It includes: -- -- module Perf