perf 0.10.2 → 0.10.3
raw patch · 7 files changed
+39/−65 lines, 7 filesdep −QuickCheckdep ~basedep ~formatn
Dependencies removed: QuickCheck
Dependency ranges changed: base, formatn
Files
- perf.cabal +29/−35
- src/Perf.hs +1/−5
- src/Perf/BigO.hs +0/−2
- src/Perf/Space.hs +2/−4
- src/Perf/Time.hs +0/−2
- src/Perf/Types.hs +7/−9
- test/doctests.hs +0/−8
perf.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: perf-version: 0.10.2+version: 0.10.3 synopsis: Low-level run time measurement. description: A set of tools to measure performance of Haskell programs.@@ -20,16 +20,19 @@ extra-source-files: ChangeLog.md source-repository head- type: git+ type: git location: https://github.com/tonyday567/perf common ghc-options-stanza ghc-options:- -Wall -Wcompat -Wincomplete-record-updates- -Wincomplete-uni-patterns -Wredundant-constraints+ -Wall+ -Wcompat+ -Wincomplete-record-updates+ -Wincomplete-uni-patterns+ -Wredundant-constraints library- import: ghc-options-stanza+ import: ghc-options-stanza exposed-modules: Perf Perf.Algos@@ -43,18 +46,18 @@ hs-source-dirs: src build-depends:- , base >=4.7 && <5- , containers ^>=0.6- , deepseq >=1.4.4 && <1.5- , formatn ^>=0.2.1- , mtl >=2.2.2 && <2.4- , numhask-space ^>=0.10- , optparse-applicative ^>=0.17- , rdtsc ^>=1.3- , recursion-schemes ^>=5.2.2- , text >=1.2 && <2.1- , time >=1.9 && <1.13- , vector >=0.12.3 && <0.14+ base >=4.7 && <5,+ containers ^>=0.6,+ deepseq >=1.4.4 && <1.5,+ formatn >=0.2.1 && < 0.4,+ mtl >=2.2.2 && <2.4,+ numhask-space ^>=0.10,+ optparse-applicative ^>=0.17,+ rdtsc ^>=1.3,+ recursion-schemes ^>=5.2.2,+ text >=1.2 && <2.1,+ time >=1.9 && <1.13,+ vector >=0.12.3 && <0.14, default-language: Haskell2010 default-extensions:@@ -65,24 +68,15 @@ main-is: explore.hs hs-source-dirs: app build-depends:- , base >=4.7 && <5- , containers ^>=0.6- , deepseq >=1.4.4 && <1.5- , formatn >=0.2 && <0.3- , gauge ^>=0.2.5- , mtl >=2.2.2 && <2.4- , optparse-applicative ^>=0.17- , perf- , text >=1.2 && <2.1+ base >=4.7 && <5,+ containers ^>=0.6,+ deepseq >=1.4.4 && <1.5,+ formatn >=0.2.1 && <0.4,+ gauge ^>=0.2.5,+ mtl >=2.2.2 && <2.4,+ optparse-applicative ^>=0.17,+ perf,+ text >=1.2 && <2.1, default-language: Haskell2010 ghc-options: -O2--test-suite doctests- type: exitcode-stdio-1.0- main-is: doctests.hs- hs-source-dirs: test- default-language: Haskell2010- build-depends:- , base- , QuickCheck
src/Perf.hs view
@@ -1,7 +1,3 @@-{-# LANGUAGE GADTs #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE RankNTypes #-}-{-# LANGUAGE RebindableSyntax #-} {-# OPTIONS_GHC -Wall #-} -- | == Introduction@@ -17,9 +13,9 @@ -- - functionality to determine performance order, in 'Perf.BigO' -- -- Usage examples can be found in app/perf-explore.hs and the project's readme.org.--- module Perf ( -- * re-exports+ -- | Various (fast loop) algorithms that have been used for testing perf functionality. module Perf.Algos, -- | Low-level time performance 'Measure's counting 'Cycles'
src/Perf/BigO.hs view
@@ -1,7 +1,5 @@ {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE NegativeLiterals #-} {-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_GHC -Wall #-}
src/Perf/Space.hs view
@@ -3,7 +3,6 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-}-{-# LANGUAGE RebindableSyntax #-} {-# OPTIONS_GHC -Wall #-} -- | Space performance measurement.@@ -13,12 +12,11 @@ spaceLabels, space, allocation,- Bytes(..),+ Bytes (..), ) where import Control.Monad.State.Lazy-import Data.String import Data.Text (Text) import Data.Word import GHC.Stats@@ -30,7 +28,7 @@ data SpaceStats = SpaceStats {allocatedBytes :: Word64, gcollects :: Word32, maxLiveBytes :: Word64, gcLiveBytes :: Word64, maxMem :: Word64} deriving (Read, Show, Eq) -- | Convert 'SpaceStats' to a list of numbers.-ssToList :: Num a => SpaceStats -> [a]+ssToList :: (Num a) => SpaceStats -> [a] ssToList (SpaceStats x1 x2 x3 x4 x5) = [fromIntegral x1, fromIntegral x2, fromIntegral x3, fromIntegral x4, fromIntegral x5] instance Semigroup SpaceStats where
src/Perf/Time.hs view
@@ -1,7 +1,5 @@ {-# LANGUAGE BangPatterns #-}-{-# LANGUAGE DerivingVia #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE RebindableSyntax #-} {-# LANGUAGE ViewPatterns #-} {-# OPTIONS_GHC -Wall #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
src/Perf/Types.hs view
@@ -1,11 +1,10 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DeriveFunctor #-}-{-# LANGUAGE GADTs #-}+{-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-}-{-# LANGUAGE RebindableSyntax #-} {-# LANGUAGE TupleSections #-} {-# OPTIONS_GHC -Wall #-} @@ -48,7 +47,6 @@ import Data.Bifunctor import Data.Functor.Identity import qualified Data.Map.Strict as Map-import Data.String import Data.Text (Text) import Prelude @@ -105,7 +103,7 @@ {-# INLINEABLE toMeasureN #-} -- | A single step measurement.-step :: Monad m => m i -> (i -> m t) -> (a -> b) -> a -> m (t, b)+step :: (Monad m) => m i -> (i -> m t) -> (a -> b) -> a -> m (t, b) step pre' post' !f !a = do !p <- pre' !b <- pure $! f a@@ -114,7 +112,7 @@ {-# INLINEABLE step #-} -- | A single step measurement.-stepM :: Monad m => m i -> (i -> m t) -> m a -> m (t, a)+stepM :: (Monad m) => m i -> (i -> m t) -> m a -> m (t, a) stepM pre' post' a = do !p <- pre' !ma <- a@@ -123,13 +121,13 @@ {-# INLINEABLE stepM #-} -- | Multiple measurement-multi :: Monad m => ((a -> b) -> a -> m (t, b)) -> Int -> (a -> b) -> a -> m ([t], b)+multi :: (Monad m) => ((a -> b) -> a -> m (t, b)) -> Int -> (a -> b) -> a -> m ([t], b) multi action n !f !a = fmap (\xs -> (fmap fst xs, snd (head xs))) (replicateM n (action f a)) {-# INLINEABLE multi #-} -- | Multiple measurements-multiM :: Monad m => (m a -> m (t, a)) -> Int -> m a -> m ([t], a)+multiM :: (Monad m) => (m a -> m (t, a)) -> Int -> m a -> m ([t], a) multiM action n a = fmap (\xs -> (fmap fst xs, snd (head xs))) (replicateM n (action a)) {-# INLINEABLE multiM #-}@@ -214,12 +212,12 @@ -- | 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+evalPerfT :: (Monad m) => Measure m t -> PerfT m t a -> m a evalPerfT m p = fmap fst <$> flip runStateT (m, Map.empty) $ measurePerf p {-# INLINEABLE evalPerfT #-} -- | Consume a PerfT layer and return the measurement.-execPerfT :: Monad m => Measure m t -> PerfT m t a -> m (Map.Map Text t)+execPerfT :: (Monad m) => Measure m t -> PerfT m t a -> m (Map.Map Text t) execPerfT m p = fmap snd <$> flip execStateT (m, Map.empty) $ measurePerf p {-# INLINEABLE execPerfT #-}
− test/doctests.hs
@@ -1,8 +0,0 @@-module Main where--main :: IO ()-main = do- putStrLn "This test-suite exists only to add dependencies"- putStrLn "To run doctests: "- putStrLn " cabal build all --enable-tests"- putStrLn " cabal-docspec"