packages feed

perf 0.12.0.0 → 0.12.0.1

raw patch · 4 files changed

+193/−210 lines, 4 filesdep ~containersdep ~gaugedep ~recursion-schemesPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: containers, gauge, recursion-schemes, text

API changes (from Hackage documentation)

Files

app/explore.hs view
@@ -70,8 +70,8 @@   addStat [l, "tickLazy"] . statD s . fmap fromIntegral =<< lift (fst <$> multi tickLazy n f a)   addStat [l, "tickForce"] . statD s . fmap fromIntegral =<< lift (fst <$> multi tickForce n f a)   addStat [l, "tickForceArgs"] . statD s . fmap fromIntegral =<< lift (fst <$> multi tickForceArgs n f a)-  addStat [l, "stepTime"] . statD s . fmap fromIntegral =<< lift (snd . head . Map.toList <$> execPerfT (toMeasureN n stepTime) (f |$| a))-  addStat [l, "times"] . statD s . fmap fromIntegral =<< lift (snd . head . Map.toList <$> execPerfT (times n) (f |$| a))+  addStat [l, "stepTime"] . statD s . fmap fromIntegral =<< lift (mconcat . fmap snd . take 1 . Map.toList <$> execPerfT (toMeasureN n stepTime) (f |$| a))+  addStat [l, "times"] . statD s . fmap fromIntegral =<< lift (mconcat . fmap snd . take 1 . Map.toList <$> execPerfT (times n) (f |$| a))  statTicksSum :: (NFData b, Enum b, Num b) => SumPattern b -> Int -> StatDType -> StateT (Map.Map [Text] Double) IO () statTicksSum (SumFuse label f a) n s = statTicks label f a n s
perf.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: perf-version: 0.12.0.0+version: 0.12.0.1 license: BSD-3-Clause license-file: LICENSE copyright: Tony Day (c) 2018@@ -15,10 +15,10 @@     See the Perf module for an example and full API documentation.  build-type: Simple-tested-with: GHC == 8.10.7 || ==9.2.8 || ==9.4.5 || ==9.6.2+tested-with: GHC == 8.10 || ==9.2 || ==9.4 || ==9.6 || ==9.8 extra-doc-files:-  ChangeLog.md-  readme.org+    ChangeLog.md+    readme.org  source-repository head     type: git@@ -104,15 +104,15 @@     hs-source-dirs: src     build-depends:         , base                 >=4.7 && <5-        , containers           >=0.6 && <0.7+        , containers           >=0.6 && <0.8         , deepseq              >=1.4.4 && <1.6         , formatn              >=0.2.1 && <0.4         , mtl                  >=2.2.2 && <2.4         , numhask-space        >=0.10 && <0.12         , optparse-applicative >=0.17 && <0.19         , rdtsc                >=1.3 && <1.4-        , recursion-schemes    ^>=5.2.2-        , text                 >=1.2 && <2.1+        , recursion-schemes    >=5.2.2 && <5.3+        , text                 >=1.2 && <2.2         , time                 >=1.9 && <1.13         , vector               >=0.12.3 && <0.14     exposed-modules:@@ -136,14 +136,14 @@     hs-source-dirs: app     build-depends:         , base                 >=4.7 && <5-        , containers           >=0.6 && <0.7+        , containers           >=0.6 && <0.8         , deepseq              >=1.4.4 && <1.6         , formatn              >=0.2.1 && <0.4-        , gauge                ^>=0.2.5+        , gauge                >=0.2.5 && <0.3         , mtl                  >=2.2.2 && <2.4         , optparse-applicative >=0.17 && <0.19         , perf-        , text                 >=1.2 && <2.1+        , text                 >=1.2 && <2.2     ghc-options: -O2  benchmark perf-bench@@ -153,7 +153,7 @@     main-is: bench.hs     hs-source-dirs: app     build-depends:-        , base                 >=4.7 && <5+        , base >=4.7 && <5         , perf     ghc-options: -O2     type: exitcode-stdio-1.0
readme.org view
@@ -18,9 +18,8 @@  Note that running this readme.org is very slow compared with an external process which accesses the compiled version of the library. -#+begin_src haskell :results output+#+begin_src haskell-ng :results output :r-:set prompt "> " :set -Wno-type-defaults :set -Wno-unused-do-bind :set -Wno-name-shadowing@@ -38,19 +37,24 @@  #+RESULTS: #+begin_example-Preprocessing library for perf-0.12.0.0..-Building library for perf-0.12.0.0..-[ 7 of 10] Compiling Perf.Report      ( src/Perf/Report.hs, /Users/tonyday/haskell/perf/dist-newstyle/build/x86_64-osx/ghc-9.6.2/perf-0.12.0.0/build/Perf/Report.o, /Users/tonyday/haskell/perf/dist-newstyle/build/x86_64-osx/ghc-9.6.2/perf-0.12.0.0/build/Perf/Report.dyn_o ) [Source file changed]-[10 of 10] Compiling Perf             ( src/Perf.hs, /Users/tonyday/haskell/perf/dist-newstyle/build/x86_64-osx/ghc-9.6.2/perf-0.12.0.0/build/Perf.o, /Users/tonyday/haskell/perf/dist-newstyle/build/x86_64-osx/ghc-9.6.2/perf-0.12.0.0/build/Perf.dyn_o ) [Source file changed]-Preprocessing benchmark 'perf-bench' for perf-0.12.0.0..-GHCi, version 9.6.2: https://www.haskell.org/ghc/  :? for help+Build profile: -w ghc-9.8.1 -O1+In order, the following will be built (use -v for more details):+ - perf-0.12.0.1 (lib) (first run)+Preprocessing library for perf-0.12.0.1..+GHCi, version 9.8.1: https://www.haskell.org/ghc/  :? for help Loaded GHCi configuration from /Users/tonyday/haskell/perf/.ghci-[1 of 2] Compiling Main             ( app/bench.hs, interpreted )-Ok, one module loaded.-> [1 of 2] Compiling Main             ( app/bench.hs, interpreted )-Ok, one module loaded.->->+[ 1 of 10] Compiling Perf.Stats       ( src/Perf/Stats.hs, interpreted )+[ 2 of 10] Compiling Perf.Types       ( src/Perf/Types.hs, interpreted )+[ 3 of 10] Compiling Perf.Time        ( src/Perf/Time.hs, interpreted )+[ 4 of 10] Compiling Perf.Space       ( src/Perf/Space.hs, interpreted )+[ 5 of 10] Compiling Perf.Count       ( src/Perf/Count.hs, interpreted )+[ 6 of 10] Compiling Perf.Measure     ( src/Perf/Measure.hs, interpreted )+[ 7 of 10] Compiling Perf.Report      ( src/Perf/Report.hs, interpreted )+[ 8 of 10] Compiling Perf.BigO        ( src/Perf/BigO.hs, interpreted )+[ 9 of 10] Compiling Perf.Algos       ( src/Perf/Algos.hs, interpreted )+[10 of 10] Compiling Perf             ( src/Perf.hs, interpreted )+Ok, 10 modules loaded.+Ok, 10 modules loaded. ok #+end_example @@ -59,7 +63,7 @@  The fundamental operation of Perf.Time is tick, which sandwiches a (strict) function application between two readings of the rdstc chip. -#+begin_src haskell :results output :exports both+#+begin_src haskell-ng :results output :exports both :t tick #+end_src @@ -74,28 +78,29 @@  tick_ measures the number of cycles between two clock reads. -#+begin_src haskell :results output :exports both+#+begin_src haskell-ng :results output :exports both :t tick_ #+end_src  #+RESULTS: : tick_ :: IO Cycles -#+begin_src haskell :results output :exports both++#+begin_src haskell-ng :results output :exports both fmap word <$> replicateM 10 tick_ #+end_src  #+RESULTS:-: [1722,788,630,606,608,620,596,638,596,598]+: [3063,1201,990,978,945,948,951,948,951,948]  ** multiple ticks -#+begin_src haskell :results output :exports both+#+begin_src haskell-ng :results output :exports both fmap (fmap (word . fst)) . replicateM 10 $ tick (const ()) () #+end_src  #+RESULTS:-: [6180,3282,2736,2712,2676,2670,2660,2634,2926,2656]+: [12104,5040,4868,4508,4188,4172,4800,4748,5760,4216]  Here, ~const () ()~ was evaluated and took 6.1k cycles for the first effect, reducing down to 2.6k after 10 effects. What it did in that time we will never know, really, at least from usage of ~perf~. 2.2k cycles is, on my 2.5GHz machine equal to 2200 / 2.5e9 = 8.8e-7 of a second or 880 nanoseconds. @@ -103,38 +108,37 @@  ~tickIO~ measures the evaluation of an IO value. -#+begin_src haskell :results output :exports both+#+begin_src haskell-ng :results output :exports both :t tickIO #+end_src  #+RESULTS: : tickIO :: IO a -> IO (Cycles, a) -#+begin_src haskell :results output :exports both+#+begin_src haskell-ng :results output :exports both fmap (fmap (word . fst)) . replicateM 10 $ tickIO (pure ()) #+end_src  #+RESULTS:-: [5508,1632,1378,1210,1576,1214,1160,1174,1176,1176]+: [10084,3588,4104,2844,2916,3140,2800,2848,2848,2804]  ** sum example -#+begin_src haskell :exports both+#+begin_src haskell-ng :exports both fmap (expt (Just 2) . fromIntegral) . fst <$> ticks 10 sum ([1..10000] :: [Double]) #+end_src  #+RESULTS:-| 2.0e6 | 1.3e6 | 1.2e6 | 6.1e6 | 1.5e6 | 1.7e6 | 3.0e6 | 6.4e5 | 6.2e5 | 1.7e6 |+: ["1.7e6","6.1e5","6.2e5","5.4e5","4.3e5","4.1e5","4.1e5","4.3e5","4.1e5","4.1e5"]  -#+begin_src haskell :results output :exports both+#+begin_src haskell-ng :results output :exports both ts <- ticks 10000 sum ([1..1000] :: [Double]) print $ average (fmap fromIntegral $ fst ts) #+end_src  #+RESULTS:-:-: 54619.4812+: 30411.6957  * PerfT @@ -142,34 +146,34 @@  Compare a lower-level usage of ticks, measuring the average of summing to one thousand over one thousand trials: -#+begin_src haskell :results output :exports both+#+begin_src haskell-ng :results output :exports both first (average . fmap fromIntegral) <$> ticks 1000 sum [1..1000] #+end_src  #+RESULTS:-: (73752.368,500500)+: (50914.804,500500)  ... with PerfT usage -#+begin_src haskell :results output :exports both+#+begin_src haskell-ng :results output :exports both second (fmap (average . fmap fromIntegral)) <$> runPerfT (times 1000) (sum |$| [1..1000]) #+end_src  #+RESULTS:-: (500500,fromList [("",62706.844)])+: (500500,fromList [("",44362.311)])  Comparing performance of sum versus a list fusion approach: -#+begin_src haskell :results output :exports both+#+begin_src haskell-ng :results output :exports both fmap (average . fmap fromIntegral) <$> (execPerfT (times 1000) $ do; (fap "sum" sum [1..1000]); (fap "fusion" (\x -> sum [1..x]) 1000)) #+end_src  #+RESULTS:-: fromList [("fusion",114013.79),("sum",63906.848)]+: fromList [("fusion",97804.085),("sum",45053.771)]  An IO example -#+begin_src haskell+#+begin_src haskell-ng exampleIO' :: IO () exampleIO' = do   txt <- Text.readFile "src/Perf.hs"@@ -177,7 +181,7 @@   Text.putStrLn $ "length of file is: " <> Text.pack (show n) #+end_src -#+begin_src haskell :results output :exports both+#+begin_src haskell-ng :results output :exports both exampleIO = execPerfT time (do   txt <- fam "file_read" (Text.readFile "src/Perf.hs")   n <- fap "length" Text.length txt@@ -185,23 +189,23 @@ #+end_src  #+begin_src sh :results output :exports both-perf-explore --exampleIO --record --check+perf-explore --exampleIO #+end_src  #+RESULTS: #+begin_example-length of file is: 1751-length of file is: 1751+length of file is: 1794+length of file is: 1794 -label1              label2              label3              old_result          new_result          status+label1          label2          label3          old result      new result      change -normal              file-read           time                4.28e5              4.19e5-normal              length              time                5.61e3              5.64e3-normal              print-result        time                5.47e4              5.38e4-outer               file-read           time                9.37e4              9.46e4-outer               length              time                5.38e3              5.40e3-outer               outer-total         time                1.11e5              1.12e5-outer               print-result        time                5.46e3              5.55e3+normal          file-read       time            5.96e5          6.58e5          slightly-degraded+normal          length          time            1.10e4          7.12e3          improvement+normal          print-result    time            1.44e5          5.70e4          improvement+outer           file-read       time            1.36e5          1.39e5+outer           length          time            1.45e3          1.33e3          improvement+outer           outer-total     time            1.67e5          1.50e5          improvement+outer           print-result    time            2.70e4          6.26e3          improvement #+end_example  * perf-explore@@ -268,23 +272,23 @@   -h,--help                Show this help text #+end_example -#+begin_src haskell :results output :exports both+#+begin_src haskell-ng :results output :exports both fmap averageI <$> execPerfT (times 10000) (sum |$| [1..1000]) #+end_src  #+RESULTS:-: fromList [("",54874.5718)]+: fromList [("",35729.9518)]  The equivalent to the above code is:  #+begin_src sh :results output :exports both-perf-explore -n 10000 -l 1000 --sum+perf-explore -n 10000 -l 1000 --sum --nocheck #+end_src  #+RESULTS:-: label1              label2              results+: label1          label2          results :-: sum                 time                1.46e4+: sum             time            1.47e4  ** noops @@ -296,22 +300,23 @@  #+RESULTS: #+begin_example-label1              label2              label3              results+label1          label2          label3          results -const               1st                 time                4.46e2-const               2nd                 time                2.20e1-const               3rd                 time                2.20e1-const               4th                 time                2.20e1-const               average             time                2.22e1-const               best                time                2.10e1-const               median              time                2.19e1-pure                1st                 time                1.46e2-pure                2nd                 time                3.40e1-pure                3rd                 time                2.40e1-pure                4th                 time                2.40e1-pure                average             time                2.41e1-pure                best                time                1.86e1-pure                median              time                2.42e1+const           1st             time            6.05e3+const           2nd             time            2.80e1+const           3rd             time            3.60e1+const           4th             time            3.20e1+const           average         time            4.11e1+const           best            time            2.74e1+const           median          time            3.54e1+pure            1st             time            6.46e3+pure            2nd             time            7.60e1+pure            3rd             time            4.00e1+pure            4th             time            4.00e1+pure            average         time            4.28e1+pure            best            time            2.82e1+pure            median          time            3.64e1+No golden file found. To create one, run with '-r' #+end_example  ** measurement context@@ -319,60 +324,31 @@ Exploration of how the code surrounding measurement effects performance.  #+begin_src sh :results drawer :exports both-perf-explore -n 1000 -l 1000 --ticks-#+end_src--#+RESULTS:-:results:-|               | stepTime |   tick | tickForce | tickForceArgs | tickLazy | tickWHNF |  times |-| sumAux        |   1.49e4 | 1.46e4 |    1.46e4 |        1.98e4 |   1.99e1 |   1.45e4 | 1.44e4 |-| sumCata       |   1.45e4 | 1.44e4 |    1.46e4 |        1.46e4 |   1.99e1 |   1.44e4 | 1.44e4 |-| sumCo         |   1.64e4 | 2.06e4 |    1.46e4 |        1.45e4 |   2.31e1 |   1.85e4 | 2.10e4 |-| sumCoCase     |   1.30e4 | 2.18e4 |    1.01e4 |        1.39e4 |   1.99e1 |   1.02e4 | 1.08e4 |-| sumCoGo       |   1.92e4 | 1.68e4 |    1.45e4 |        1.71e4 |   1.98e1 |   1.45e4 | 1.54e4 |-| sumF          |   1.33e4 | 1.34e4 |    1.34e4 |        1.34e4 |   1.97e1 |   1.34e4 | 1.34e4 |-| sumFlip       |   1.34e4 | 1.33e4 |    1.66e4 |        1.55e4 |   1.98e1 |   1.33e4 | 1.34e4 |-| sumFlipLazy   |   1.33e4 | 1.37e4 |    1.88e4 |        1.40e4 |   1.97e1 |   1.34e4 | 1.35e4 |-| sumFoldr      |   1.45e4 | 1.59e4 |    1.58e4 |        1.48e4 |   2.12e1 |   1.52e4 | 1.44e4 |-| sumFuse       |   2.01e3 | 1.80e3 |    1.81e3 |        1.54e3 |   1.97e1 |   2.04e3 | 1.65e3 |-| sumFuseFoldl' |   2.14e3 | 1.80e3 |    1.92e3 |        1.71e3 |   1.97e1 |   1.98e3 | 1.66e3 |-| sumFuseFoldr  |   8.58e3 | 5.43e3 |    5.13e3 |        5.84e3 |   1.97e1 |   5.26e3 | 7.13e3 |-| sumFusePoly   |   1.92e3 | 1.93e3 |    1.96e3 |        1.58e3 |   2.00e1 |   1.60e3 | 1.94e3 |-| sumLambda     |   1.34e4 | 1.34e4 |    1.35e4 |        1.33e4 |   2.05e1 |   1.34e4 | 1.34e4 |-| sumMono       |   1.35e4 | 1.34e4 |    1.34e4 |        1.34e4 |   1.98e1 |   1.33e4 | 1.38e4 |-| sumPoly       |   2.90e4 | 1.34e4 |    5.43e4 |        2.90e4 |   2.01e1 |   1.34e4 | 2.90e4 |-| sumSum        |   1.33e4 | 1.34e4 |    1.33e4 |        1.34e4 |   1.96e1 |   1.34e4 | 1.34e4 |-| sumTail       |   1.47e4 | 1.59e4 |    1.34e4 |        1.81e4 |   2.02e1 |   1.34e4 | 1.33e4 |-| sumTailLazy   |   1.35e4 | 1.39e4 |    1.37e4 |        1.34e4 |   2.18e1 |   1.38e4 | 1.36e4 |-:end:---#+begin_src sh :results drawer :exports both-perf-explore -n 100000 -l 1000 --ticks+perf-explore -n 1000 -l 1000 --ticks --nocheck #+end_src  #+RESULTS: :results: |               | stepTime |   tick | tickForce | tickForceArgs | tickLazy | tickWHNF |  times |-| sumAux        |   1.83e4 | 1.83e4 |    1.81e4 |        1.81e4 |   1.75e1 |   1.81e4 | 1.86e4 |-| sumCata       |   2.16e4 | 2.16e4 |    2.08e4 |        2.09e4 |   1.75e1 |   2.11e4 | 2.09e4 |-| sumCo         |   1.83e4 | 1.82e4 |    1.82e4 |        1.88e4 |   1.74e1 |   1.81e4 | 1.81e4 |-| sumCoCase     |   1.59e4 | 1.87e4 |    1.54e4 |        1.57e4 |   1.76e1 |   1.83e4 | 1.54e4 |-| sumCoGo       |   2.06e4 | 2.07e4 |    2.07e4 |        2.11e4 |   1.74e1 |   2.07e4 | 2.12e4 |-| sumF          |   8.87e3 | 9.05e3 |    8.61e3 |        8.73e3 |   1.73e1 |   8.66e3 | 8.84e3 |-| sumFlip       |   8.57e3 | 8.66e3 |    8.49e3 |        8.65e3 |   1.74e1 |   8.70e3 | 8.80e3 |-| sumFlipLazy   |   5.60e3 | 8.68e3 |    8.74e3 |        5.91e3 |   1.75e1 |   8.91e3 | 5.53e3 |-| sumFoldr      |   2.14e4 | 2.10e4 |    2.08e4 |        2.08e4 |   1.75e1 |   2.09e4 | 2.12e4 |-| sumFuse       |   2.23e3 | 2.13e3 |    2.11e3 |        2.02e3 |   1.69e1 |   1.98e3 | 2.15e3 |-| sumFuseFoldl' |   2.14e3 | 2.03e3 |    2.20e3 |        1.97e3 |   1.76e1 |   2.22e3 | 2.14e3 |-| sumFuseFoldr  |   1.22e4 | 1.28e4 |    1.23e4 |        1.28e4 |   1.69e1 |   1.26e4 | 1.23e4 |-| sumFusePoly   |   1.67e3 | 1.47e3 |    1.46e3 |        1.47e3 |   1.71e1 |   1.42e3 | 1.65e3 |-| sumLambda     |   9.04e3 | 8.75e3 |    8.70e3 |        8.80e3 |   1.77e1 |   8.70e3 | 9.09e3 |-| sumMono       |   5.97e3 | 5.96e3 |    5.82e3 |        6.26e3 |   1.85e1 |   5.69e3 | 5.91e3 |-| sumPoly       |   8.74e3 | 8.85e3 |    8.70e3 |        8.73e3 |   1.76e1 |   8.64e3 | 8.76e3 |-| sumSum        |   5.90e3 | 6.36e3 |    5.78e3 |        5.78e3 |   1.81e1 |   6.05e3 | 5.88e3 |-| sumTail       |   1.21e4 | 6.48e3 |    5.85e3 |        1.19e4 |   1.76e1 |   5.86e3 | 1.22e4 |-| sumTailLazy   |   6.05e3 | 8.40e3 |    6.02e3 |        5.74e3 |   1.75e1 |   5.91e3 | 5.94e3 |+| sumAux        |   1.46e4 | 1.51e4 |    1.65e4 |        1.45e4 |   1.96e1 |   1.45e4 | 1.46e4 |+| sumCata       |   1.45e4 | 1.82e4 |    1.45e4 |        1.45e4 |   1.99e1 |   1.46e4 | 1.48e4 |+| sumCo         |   1.45e4 | 1.46e4 |    1.46e4 |        1.63e4 |   2.02e1 |   1.45e4 | 1.44e4 |+| sumCoCase     |   1.44e4 | 1.51e4 |    1.61e4 |        1.46e4 |   2.78e1 |   2.10e4 | 1.49e4 |+| sumCoGo       |   2.61e4 | 1.46e4 |    3.82e4 |        2.55e4 |   2.04e1 |   1.45e4 | 2.59e4 |+| sumF          |   1.34e4 | 1.34e4 |    2.01e4 |        1.64e4 |   2.01e1 |   1.33e4 | 1.33e4 |+| sumFlip       |   1.37e4 | 1.34e4 |    1.34e4 |        1.33e4 |   2.06e1 |   1.41e4 | 1.33e4 |+| sumFlipLazy   |   1.33e4 | 1.34e4 |    1.33e4 |        1.34e4 |   2.01e1 |   1.37e4 | 1.34e4 |+| sumFoldr      |   1.44e4 | 1.45e4 |    2.18e4 |        1.68e4 |   3.22e1 |   1.54e4 | 1.45e4 |+| sumFuse       |   3.19e3 | 1.98e3 |    1.93e3 |        2.19e3 |   1.98e1 |   1.83e3 | 3.15e3 |+| sumFuseFoldl' |   1.88e3 | 2.46e3 |    2.02e3 |        2.27e3 |   2.39e1 |   2.38e3 | 2.15e3 |+| sumFuseFoldr  |   5.79e3 | 6.01e3 |    3.70e3 |        3.70e3 |   2.00e1 |   3.70e3 | 6.11e3 |+| sumFusePoly   |   2.67e3 | 2.68e3 |    2.65e3 |        2.29e3 |   2.73e1 |   2.44e3 | 2.60e3 |+| sumLambda     |   1.59e4 | 1.35e4 |    1.47e4 |        1.99e4 |   1.99e1 |   1.36e4 | 1.34e4 |+| sumMono       |   1.38e4 | 1.69e4 |    1.35e4 |        1.36e4 |   2.04e1 |   1.37e4 | 1.34e4 |+| sumPoly       |   1.99e4 | 1.42e4 |    1.35e4 |        1.73e4 |   1.97e1 |   1.35e4 | 1.51e4 |+| sumSum        |   1.34e4 | 1.36e4 |    1.34e4 |        1.35e4 |   1.99e1 |   1.34e4 | 2.01e4 |+| sumTail       |   2.03e4 | 1.37e4 |    1.34e4 |        1.34e4 |   1.99e1 |   1.34e4 | 2.01e4 |+| sumTailLazy   |   1.34e4 | 1.66e4 |    1.33e4 |        1.41e4 |   1.99e1 |   1.35e4 | 1.33e4 | :end:  *** short list@@ -383,27 +359,28 @@ #+RESULTS: :results: |               | stepTime |   tick | tickForce | tickForceArgs | tickLazy | tickWHNF |  times |-| sumAux        |   8.94e1 | 9.30e1 |    9.15e1 |        8.97e1 |   1.54e1 |   9.14e1 | 8.96e1 |-| sumCata       |   9.74e1 | 9.79e1 |    9.78e1 |        9.81e1 |   1.55e1 |   9.77e1 | 9.62e1 |-| sumCo         |   9.11e1 | 1.16e2 |    9.15e1 |        9.13e1 |   1.51e1 |   9.11e1 | 8.92e1 |-| sumCoCase     |   9.05e1 | 9.21e1 |    9.18e1 |        9.18e1 |   1.53e1 |   8.99e1 | 8.90e1 |-| sumCoGo       |   9.76e1 | 9.90e1 |    9.76e1 |        9.84e1 |   1.54e1 |   9.76e1 | 9.70e1 |-| sumF          |   7.54e1 | 7.94e1 |    7.75e1 |        7.78e1 |   1.53e1 |   7.73e1 | 7.56e1 |-| sumFlip       |   7.72e1 | 8.07e1 |    7.75e1 |        7.75e1 |   1.51e1 |   7.78e1 | 7.55e1 |-| sumFlipLazy   |   7.74e1 | 7.93e1 |    7.72e1 |        7.78e1 |   1.55e1 |   7.62e1 | 7.55e1 |-| sumFoldr      |   9.75e1 | 9.88e1 |    9.70e1 |        9.77e1 |   1.52e1 |   9.78e1 | 9.71e1 |-| sumFuse       |   3.59e1 | 3.53e1 |    3.52e1 |        3.22e1 |   1.49e1 |   3.33e1 | 3.22e1 |-| sumFuseFoldl' |   3.52e1 | 3.50e1 |    3.52e1 |        3.30e1 |   1.50e1 |   3.33e1 | 3.27e1 |-| sumFuseFoldr  |   5.00e1 | 4.99e1 |    5.06e1 |        4.91e1 |   1.50e1 |   4.91e1 | 4.94e1 |-| sumFusePoly   |   4.42e1 | 4.39e1 |    4.36e1 |        4.19e1 |   1.51e1 |   4.15e1 | 4.31e1 |-| sumLambda     |   7.93e1 | 8.10e1 |    7.94e1 |        7.93e1 |   1.54e1 |   7.92e1 | 7.73e1 |-| sumMono       |   6.33e1 | 6.56e1 |    6.36e1 |        6.36e1 |   1.53e1 |   6.35e1 | 6.31e1 |-| sumPoly       |   7.93e1 | 8.01e1 |    7.92e1 |        7.93e1 |   1.53e1 |   7.93e1 | 7.73e1 |-| sumSum        |   7.93e1 | 7.98e1 |    7.95e1 |        7.95e1 |   1.52e1 |   7.93e1 | 7.73e1 |-| sumTail       |   6.75e1 | 6.99e1 |    6.80e1 |        6.78e1 |   1.56e1 |   6.70e1 | 6.72e1 |-| sumTailLazy   |   6.80e1 | 7.18e1 |    6.80e1 |        6.89e1 |   1.52e1 |   6.85e1 | 6.72e1 |+| sumAux        |   1.81e2 | 2.33e2 |    1.81e2 |        1.82e2 |   1.32e1 |   1.83e2 | 1.82e2 |+| sumCata       |   1.81e2 | 2.33e2 |    1.81e2 |        1.82e2 |   1.33e1 |   2.33e2 | 1.81e2 |+| sumCo         |   2.10e2 | 2.33e2 |    2.13e2 |        2.11e2 |   2.49e1 |   2.33e2 | 2.10e2 |+| sumCoCase     |   1.81e2 | 2.47e2 |    1.82e2 |        1.82e2 |   1.83e1 |   2.47e2 | 1.81e2 |+| sumCoGo       |   1.81e2 | 2.34e2 |    2.34e2 |        2.34e2 |   1.33e1 |   2.33e2 | 1.82e2 |+| sumF          |   1.03e2 | 2.22e2 |    1.05e2 |        1.04e2 |   1.88e1 |   1.83e2 | 1.04e2 |+| sumFlip       |   1.13e2 | 1.28e2 |    1.20e2 |        1.20e2 |   1.88e1 |   1.17e2 | 1.63e2 |+| sumFlipLazy   |   1.13e2 | 2.07e2 |    1.76e2 |        1.20e2 |   2.49e1 |   2.04e2 | 1.01e2 |+| sumFoldr      |   1.81e2 | 2.66e2 |    2.65e2 |        1.81e2 |   1.88e1 |   2.65e2 | 1.81e2 |+| sumFuse       |   2.58e1 | 2.71e1 |    2.85e1 |        3.36e1 |   1.36e1 |   3.36e1 | 3.42e1 |+| sumFuseFoldl' |   5.04e1 | 2.71e1 |    5.11e1 |        5.08e1 |   1.41e1 |   2.65e1 | 3.96e1 |+| sumFuseFoldr  |   8.16e1 | 8.61e1 |    6.26e1 |        7.34e1 |   1.25e1 |   8.47e1 | 8.54e1 |+| sumFusePoly   |   4.19e1 | 5.82e1 |    4.26e1 |        5.81e1 |   1.30e1 |   5.91e1 | 4.30e1 |+| sumLambda     |   1.39e2 | 1.30e2 |    1.60e2 |        1.63e2 |   1.33e1 |   1.29e2 | 1.43e2 |+| sumMono       |   8.04e1 | 1.43e2 |    8.64e1 |        8.41e1 |   1.83e1 |   1.15e2 | 8.16e1 |+| sumPoly       |   1.16e2 | 1.29e2 |    1.44e2 |        1.21e2 |   2.49e1 |   1.30e2 | 1.18e2 |+| sumSum        |   1.02e2 | 1.03e2 |    1.04e2 |        1.05e2 |   1.33e1 |   1.02e2 | 1.04e2 |+| sumTail       |   1.40e2 | 1.37e2 |    1.31e2 |        1.31e2 |   1.36e1 |   1.45e2 | 1.42e2 |+| sumTailLazy   |   1.06e2 | 1.78e2 |    1.12e2 |        1.12e2 |   1.84e1 |   2.25e2 | 1.09e2 | :end: + *** long list #+begin_src sh :results drawer :exports both perf-explore -n 100 -l 100000 --best --ticks@@ -412,25 +389,25 @@ #+RESULTS: :results: |               | stepTime |   tick | tickForce | tickForceArgs | tickLazy | tickWHNF |  times |-| sumAux        |   2.26e6 | 2.28e6 |    2.28e6 |        2.25e6 |   1.68e1 |   2.31e6 | 2.26e6 |-| sumCata       |   2.84e6 | 2.82e6 |    2.81e6 |        3.21e6 |   1.56e1 |   2.82e6 | 2.81e6 |-| sumCo         |   2.26e6 | 2.27e6 |    5.02e6 |        2.27e6 |   1.66e1 |   2.28e6 | 2.28e6 |-| sumCoCase     |   2.28e6 | 2.30e6 |    2.32e6 |        2.28e6 |   1.48e1 |   2.97e6 | 2.30e6 |-| sumCoGo       |   2.84e6 | 2.80e6 |    2.84e6 |        2.85e6 |   1.51e1 |   2.81e6 | 2.81e6 |-| sumF          |   7.76e5 | 7.78e5 |    7.80e5 |        7.81e5 |   1.51e1 |   9.76e5 | 7.05e5 |-| sumFlip       |   7.48e5 | 9.04e5 |    7.46e5 |        7.43e5 |   1.68e1 |   7.48e5 | 7.44e5 |-| sumFlipLazy   |   1.21e6 | 1.22e6 |    1.19e6 |        1.19e6 |   1.61e1 |   1.20e6 | 1.20e6 |-| sumFoldr      |   3.63e6 | 2.87e6 |    3.25e6 |        2.81e6 |   1.45e1 |   5.89e6 | 2.81e6 |-| sumFuse       |   1.92e5 | 1.92e5 |    1.92e5 |        1.92e5 |   1.47e1 |   1.92e5 | 1.92e5 |-| sumFuseFoldl' |   1.92e5 | 1.92e5 |    1.92e5 |        1.92e5 |   1.52e1 |   1.92e5 | 1.92e5 |-| sumFuseFoldr  |   1.68e6 | 1.64e6 |    1.65e6 |        1.65e6 |   1.50e1 |   1.65e6 | 1.65e6 |-| sumFusePoly   |   1.32e5 | 1.28e5 |    1.28e5 |        1.28e5 |   1.48e1 |   1.32e5 | 1.28e5 |-| sumLambda     |   7.90e5 | 8.01e5 |    7.93e5 |        7.92e5 |   1.57e1 |   7.93e5 | 7.92e5 |-| sumMono       |   7.86e5 | 8.04e5 |    7.87e5 |        7.83e5 |   1.48e1 |   7.99e5 | 7.88e5 |-| sumPoly       |   7.99e5 | 8.18e5 |    8.06e5 |        8.00e5 |   1.64e1 |   8.10e5 | 8.00e5 |-| sumSum        |   7.82e5 | 7.92e5 |    7.85e5 |        7.82e5 |   1.66e1 |   7.88e5 | 7.87e5 |-| sumTail       |   7.43e5 | 7.84e5 |    8.23e5 |        8.18e5 |   1.61e1 |   7.89e5 | 7.38e5 |-| sumTailLazy   |   1.35e6 | 1.37e6 |    1.34e6 |        1.33e6 |   1.58e1 |   1.35e6 | 1.34e6 |+| sumAux        |   2.82e6 | 2.70e6 |    2.66e6 |        2.75e6 |   1.83e1 |   2.70e6 | 2.79e6 |+| sumCata       |   2.71e6 | 2.69e6 |    2.63e6 |        2.64e6 |   1.28e1 |   2.68e6 | 2.75e6 |+| sumCo         |   2.71e6 | 2.73e6 |    2.63e6 |        2.64e6 |   2.52e1 |   2.71e6 | 2.73e6 |+| sumCoCase     |   2.69e6 | 2.70e6 |    2.70e6 |        2.65e6 |   1.85e1 |   2.76e6 | 2.67e6 |+| sumCoGo       |   2.68e6 | 2.77e6 |    2.65e6 |        2.63e6 |   1.82e1 |   2.75e6 | 2.69e6 |+| sumF          |   1.24e6 | 1.24e6 |    1.24e6 |        1.24e6 |   1.26e1 |   1.24e6 | 1.27e6 |+| sumFlip       |   1.16e6 | 1.14e6 |    1.14e6 |        1.16e6 |   1.35e1 |   1.13e6 | 1.16e6 |+| sumFlipLazy   |   1.03e6 | 1.03e6 |    1.03e6 |        1.02e6 |   1.37e1 |   1.03e6 | 1.03e6 |+| sumFoldr      |   2.76e6 | 2.83e6 |    2.66e6 |        2.67e6 |   1.82e1 |   2.81e6 | 2.74e6 |+| sumFuse       |   1.45e5 | 1.45e5 |    1.45e5 |        1.44e5 |   1.39e1 |   1.45e5 | 1.45e5 |+| sumFuseFoldl' |   1.45e5 | 1.45e5 |    1.45e5 |        1.46e5 |   1.35e1 |   1.45e5 | 1.45e5 |+| sumFuseFoldr  |   1.76e6 | 1.77e6 |    1.75e6 |        1.75e6 |   1.90e1 |   1.76e6 | 1.75e6 |+| sumFusePoly   |   1.45e5 | 2.00e5 |    1.45e5 |        1.45e5 |   1.32e1 |   1.68e5 | 1.45e5 |+| sumLambda     |   9.35e5 | 9.52e5 |    9.35e5 |        9.38e5 |   2.48e1 |   9.46e5 | 9.44e5 |+| sumMono       |   1.13e6 | 1.12e6 |    1.11e6 |        1.11e6 |   1.23e1 |   1.11e6 | 1.11e6 |+| sumPoly       |   1.03e6 | 1.04e6 |    1.02e6 |        1.03e6 |   1.32e1 |   1.03e6 | 1.03e6 |+| sumSum        |   1.20e6 | 1.22e6 |    1.20e6 |        1.19e6 |   1.32e1 |   1.22e6 | 1.20e6 |+| sumTail       |   1.22e6 | 1.22e6 |    1.22e6 |        1.22e6 |   1.28e1 |   1.22e6 | 1.22e6 |+| sumTailLazy   |   1.16e6 | 1.19e6 |    1.18e6 |        1.16e6 |   1.29e1 |   1.18e6 | 1.16e6 | :end:  ** sums@@ -440,28 +417,30 @@ #+end_src  #+RESULTS:-| label1        | label2 | results |-|               |        |         |-| sumAux        | time   | 16200.0 |-| sumCata       | time   | 15600.0 |-| sumCo         | time   | 19100.0 |-| sumCoCase     | time   | 16300.0 |-| sumCoGo       | time   | 15700.0 |-| sumF          | time   | 10500.0 |-| sumFlip       | time   | 10500.0 |-| sumFlipLazy   | time   |  6130.0 |-| sumFoldr      | time   | 16900.0 |-| sumFuse       | time   |  1950.0 |-| sumFuseFoldl' | time   |  1950.0 |-| sumFuseFoldr  | time   | 14600.0 |-| sumFusePoly   | time   |  1400.0 |-| sumLambda     | time   |  9780.0 |-| sumMono       | time   | 11200.0 |-| sumPoly       | time   | 11500.0 |-| sumSum        | time   | 11100.0 |-| sumTail       | time   | 11000.0 |-| sumTailLazy   | time   | 11100.0 |+#+begin_example+label1          label2          old result      new result      change +sumAux          time            1.51e4          1.46e4+sumCata         time            1.55e4          1.46e4          improvement+sumCo           time            1.55e4          2.01e4          degraded+sumCoCase       time            1.57e4          1.47e4          improvement+sumCoGo         time            1.54e4          1.69e4          slightly-degraded+sumF            time            1.33e4          2.02e4          degraded+sumFlip         time            1.41e4          1.36e4+sumFlipLazy     time            1.47e4          1.93e4          degraded+sumFoldr        time            1.56e4          1.75e4          slightly-degraded+sumFuse         time            1.66e3          2.61e3          degraded+sumFuseFoldl'   time            1.71e3          2.70e3          degraded+sumFuseFoldr    time            5.83e3          6.72e3          slightly-degraded+sumFusePoly     time            2.12e3          2.64e3          degraded+sumLambda       time            1.47e4          1.39e4          improvement+sumMono         time            1.73e4          1.40e4          improvement+sumPoly         time            1.87e4          1.36e4          improvement+sumSum          time            1.33e4          1.34e4+sumTail         time            1.47e4          1.40e4          improvement+sumTailLazy     time            1.44e4          1.34e4          improvement+#+end_example+ ** lengths  #+begin_src sh :exports both@@ -469,20 +448,22 @@ #+end_src  #+RESULTS:-| label1           | label2 | results |-|                  |        |         |-| lengthAux        | time   | 11000.0 |-| lengthCo         | time   | 11100.0 |-| lengthCoCase     | time   | 10500.0 |-| lengthF          | time   |  9540.0 |-| lengthFMono      | time   |  9190.0 |-| lengthFlip       | time   |  9770.0 |-| lengthFlipLazy   | time   |  4830.0 |-| lengthFoldr      | time   | 10100.0 |-| lengthFoldrConst | time   | 11100.0 |-| lengthTail       | time   |  9830.0 |-| lengthTailLazy   | time   |  9540.0 |+#+begin_example+label1          label2          old result      new result      change +lengthAux       time            1.45e4          1.60e4          slightly-degraded+lengthCo        time            1.64e4          1.39e4          improvement+lengthCoCase    time            1.78e4          1.31e4          improvement+lengthF         time            1.06e4          1.10e4+lengthFMono     time            1.05e4          1.05e4+lengthFlip      time            1.11e4          1.07e4+lengthFlipLazy  time            1.13e4          1.07e4          improvement+lengthFoldr     time            1.27e4          1.33e4          slightly-degraded+lengthFoldrConsttime            1.27e4          1.36e4          slightly-degraded+lengthTail      time            1.08e4          1.10e4+lengthTailLazy  time            1.15e4          1.03e4          improvement+#+end_example+ ** Gauge comparison  #+begin_src sh :results output :exports both@@ -538,13 +519,14 @@ #+end_src  #+RESULTS:-| label1 | label2       |  results |-|        |              |          |-| sum    | MaxMem       | 839000.0 |-| sum    | allocated    | 416000.0 |-| sum    | gcLiveBytes  | 220000.0 |-| sum    | gcollects    |      0.1 |-| sum    | maxLiveBytes |      0.0 |+: label1          label2          results+:+: sum             MaxMem          4.61e6+: sum             allocated       4.19e5+: sum             gcLiveBytes     2.19e5+: sum             gcollects       1.00e-1+: sum             maxLiveBytes    0.00e0+: No golden file found. To create one, run with '-r'  * Perf.BigO @@ -557,14 +539,14 @@ - estimate the order factor for each possible Order, from N3 to N0, setting the highest n run constant factor to zero, - pick the order based on lowest absolute error result summed across all the runs, -#+begin_src haskell :results output :exports both+#+begin_src haskell-ng :results output :exports both import qualified Prelude as P import Data.List (nub) estOrder (\x -> sum $ nub [1..x]) 10 [1,10,100,1000] #+end_src  #+RESULTS:-: BigOrder {bigOrder = N2, bigFactor = 13.545801, bigConstant = 0.0}+: BigOrder {bigOrder = N2, bigFactor = 13.375059, bigConstant = 0.0}  * References 
src/Perf/Types.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -Wno-x-partial #-}  -- | Abstract types of performance measurement. module Perf.Types