packages feed

perf 0.14.0.3 → 0.14.2.0

raw patch · 7 files changed

+16/−41 lines, 7 filesdep −tastydep −tasty-bench

Dependencies removed: tasty, tasty-bench

Files

app/bench.hs view
@@ -9,4 +9,4 @@ main = do   let l = 1000   let a = ExampleSum-  reportMain a defaultReportOptions (List.intercalate "-" [show a, show @Int l]) (testExample . examplePattern a)+  reportMain defaultReportOptions (List.intercalate "-" [show a, show @Int l]) (testExample . examplePattern a)
app/explore.hs view
@@ -108,7 +108,6 @@   case r of     RunExample -> do       reportMain-        a         repOptions         (intercalate "-" [show r, show a, show l])         (testExample . examplePattern a)
perf.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: perf-version: 0.14.0.3+version: 0.14.2.0 license: BSD-3-Clause license-file: LICENSE copyright: Tony Day (c) 2018@@ -9,17 +9,16 @@ maintainer: tonyday567@gmail.com homepage: https://github.com/tonyday567/perf#readme bug-reports: https://github.com/tonyday567/perf/issues-synopsis: Performance methods and monad.+synopsis: Performance tools description:   A set of tools to measure performance of Haskell programs.   See the Perf module and readme for an example and full API documentation.  build-type: Simple tested-with:-  ghc ==9.6.7-  ghc ==9.8.4-  ghc ==9.10.2+  ghc ==9.10.3   ghc ==9.12.2+  ghc ==9.14.1  extra-doc-files:   ChangeLog.md@@ -87,8 +86,6 @@     prettychart >=0.3 && <0.4,     prettyprinter >=1.7.1 && <1.8,     recursion-schemes >=5.2.2 && <5.3,-    tasty >=1.5.2 && <1.6,-    tasty-bench >=0.4 && <0.5,     text >=1.2 && <2.2,     vector >=0.12.3 && <0.14, 
readme.md view
@@ -29,7 +29,8 @@ Summing [1..1000] took 9,930 nanoseconds, an improvement versus the on file performance previously measured.  Live charts of raw performance measurement can be obtained via the prettychart library with:-+    +    cabal install prettychart     prettychart-watch --watch --filepath other --port 3566  &#x2026; and pointer your browser at localhost:3566
src/Perf/Algos.hs view
@@ -17,7 +17,6 @@     examplePattern,     exampleLabel,     testExample,-    tastyExample,      -- * sum algorithms     SumPattern (..),@@ -82,7 +81,6 @@ import Control.Monad (void) import Control.Monad.IO.Class (MonadIO (..)) import Data.Bifunctor-import Data.Foldable import Data.Functor.Foldable import Data.List qualified as List import Data.Map.Strict qualified as Map@@ -90,7 +88,6 @@ import Options.Applicative import Options.Applicative.Help.Pretty import Perf.Types-import Test.Tasty.Bench  -- | Algorithm examples for testing data Example = ExampleSumFuse | ExampleSum | ExampleLengthF | ExampleConstFuse | ExampleMapInc | ExampleNoOp | ExampleNub | ExampleFib deriving (Eq, Show)@@ -151,17 +148,6 @@ testExample (PatternNoOp label f a) = void $ ffap label f a testExample (PatternNub label f a) = void $ ffap label f a testExample (PatternFib label f a) = void $ ffap label f a---- | Convert an 'ExamplePattern' to a tasty-bench run.-tastyExample :: ExamplePattern Int -> Benchmarkable-tastyExample (PatternSumFuse _ f a) = nf f a-tastyExample (PatternSum _ f a) = nf f a-tastyExample (PatternLengthF _ f a) = nf f a-tastyExample (PatternConstFuse _ f a) = nf f a-tastyExample (PatternMapInc _ f a) = nf f a-tastyExample (PatternNoOp _ f a) = nf f a-tastyExample (PatternNub _ f a) = nf f a-tastyExample (PatternFib _ f a) = nf f a  -- | Unification of sum function applications data SumPattern a
src/Perf/Chart.hs view
@@ -58,7 +58,9 @@     <*> switch (long "averages")  perfCharts :: PerfChartOptions -> Maybe [Text] -> Map.Map Text [[Double]] -> ChartOptions-perfCharts cfg labels m = bool (stackCO stackn AlignLeft NoAlign 0.1 cs) (head cs) (length cs == 1)+perfCharts cfg labels m = case cs of+  [c] -> c+  _ -> stackCO stackn AlignLeft NoAlign 0.1 cs   where     stackn = length cs & fromIntegral & sqrt @Double & ceiling     cs = uncurry (perfChart cfg) <$> ps'@@ -138,7 +140,9 @@     xs' = xs & fmap (\(_, _, x) -> x)     cfg' = xs & fmap (\(x, _, _) -> x)     t' = xs & fmap (\(_, x, _) -> x)-    cfg = head cfg'+    cfg = case cfg' of+      (c : _) -> c+      [] -> defaultPerfChartOptions     xsSmall = xs' & fmap (xify >>> filter (_y >>> (< upperCutoff)) >>> filter (\x -> view #excludeZeros cfg && (_y x > 0)))     xsBig = xs' & fmap (xify >>> filter (_y >>> (>= upperCutoff)))     med = median <$> xs'
src/Perf/Report.hs view
@@ -49,7 +49,6 @@ import Optics.Core import Options.Applicative as OA import Options.Applicative.Help.Pretty-import Perf.Algos import Perf.BigO import Perf.Chart import Perf.Measure@@ -60,8 +59,6 @@ import System.Clock import System.Exit import System.Mem-import Test.Tasty-import Test.Tasty.Bench import Text.PrettyPrint.Boxes qualified as B import Text.Printf hiding (parseFormat) import Text.Read@@ -93,8 +90,7 @@     reportChart :: PerfChartOptions,     reportDump :: PerfDumpOptions,     reportGC :: Bool,-    reportOrder :: OrderOptions,-    reportTasty :: Bool+    reportOrder :: OrderOptions   }   deriving (Eq, Show, Generic) @@ -114,7 +110,6 @@     defaultPerfDumpOptions     False     defaultOrderOptions-    False  -- | Command-line parser for 'ReportOptions' parseReportOptions :: ReportOptions -> Parser ReportOptions@@ -132,7 +127,6 @@     <*> parsePerfDumpOptions defaultPerfDumpOptions     <*> switch (long "gc" <> help "run the GC prior to measurement")     <*> parseOrderOptions defaultOrderOptions-    <*> switch (long "tasty" <> help "run tasty-bench")  -- | Parse command-line 'Clock' options. parseClock :: Parser Clock@@ -164,8 +158,8 @@ fromDump cfg = read <$> readFile (view #dumpFilepath cfg)  -- | Run and report a benchmark with the specified reporting options.-reportMain :: Example -> ReportOptions -> Name -> (Int -> PerfT IO [[Double]] a) -> IO a-reportMain ex o name t = do+reportMain :: ReportOptions -> Name -> (Int -> PerfT IO [[Double]] a) -> IO a+reportMain o name t = do   let !n = reportN o   let l = reportLength o   let s = reportStatDType o@@ -178,7 +172,6 @@   (\cfg -> when (view #doChart cfg) (writeChartOptions (view #chartFilepath cfg) (perfCharts cfg (Just (measureLabels mt)) m))) (reportChart o)   (\cfg -> when (view #doDump cfg) (writeFile (view #dumpFilepath cfg) (show m))) (reportDump o)   when (view (#reportOrder % #doOrder) o) (reportBigO o t)-  when (view #reportTasty o) (reportTasty' ex o)   pure a  -- | Levels of geometric difference in compared performance that triggers reporting.@@ -354,8 +347,3 @@     os m' = fmap (fmap (pretty . fromOrder . fst . estO (fromIntegral <$> ns)) . List.transpose) (Map.unionsWith (<>) (fmap (fmap (: [])) (ms m')))     os' m' = mconcat $ (\(ks, xss) -> zipWith (\x l' -> ([ks] <> [l'], x)) xss (measureLabels (reportMeasureType o))) <$> Map.toList (os m')     os'' m' = (\(k, v) -> (pretty . Text.intercalate ":") k <> " " <> v) <$> os' m'--reportTasty' :: Example -> ReportOptions -> IO ()-reportTasty' ex o = do-  t <- measureCpuTime (mkTimeout 1000000) (RelStDev 0.05) (tastyExample (examplePattern ex (view #reportLength o)))-  Text.putStrLn $ "tasty:time: " <> decimal (Just 3) (t * 1e9)