on 09c955e help sign in
streamly/benchmark/ChartLinear.hs
54 lines 2.0 kB history raw
1{-# LANGUAGE TupleSections #-}
2{-# LANGUAGE ScopedTypeVariables #-}
4module Main where
6import Data.List
7import Data.List.Split
8import BenchGraph (bgraph, defaultConfig, Config(..), ComparisonStyle(..))
9import Control.Exception (handle, catch, SomeException, ErrorCall(..))
11main :: IO ()
12main = do
13 let cfg = defaultConfig
14 { outputDir = "charts"
15 , comparisonStyle = CompareDelta
16 }
18 ignoringErr a = catch a (\(ErrorCall err :: ErrorCall) ->
19 putStrLn $ "Failed with error:\n" ++ err ++ "\nSkipping.")
20 -- bgraph <input> <output> <field in csv file to be plotted>
21 -- other interesting fields to plot are:
22 -- allocated
23 -- bytesCopied
24 -- mutatorCpuSeconds
25 -- gcCpuSeconds
26 ignoringErr $ bgraph "charts/results.csv" "operations" "time" $ cfg
27 { chartTitle = Just "Streamly operations (time)"
28 , classifyBenchmark = \b ->
29 if (not $ "serially/" `isPrefixOf` b)
30 || "/generation" `isInfixOf` b
31 || "/compose" `isInfixOf` b
32 || "/concat" `isSuffixOf` b
33 then Nothing
34 else Just ("Streamly", last $ splitOn "/" b)
35 }
37 ignoringErr $ bgraph "charts/results.csv" "generation" "time" $ cfg
38 { chartTitle = Just "Stream generation (time)"
39 , classifyBenchmark = \b ->
40 if "serially/generation" `isPrefixOf` b
41 then Just ("Streamly", last $ splitOn "/" b)
42 else Nothing
43 }
45 ignoringErr $ bgraph "charts/results.csv" "composition" "time" $ cfg
46 { chartTitle = Just "Streamly composition performance (time)"
47 , classifyBenchmark = fmap ("Streamly",) . stripPrefix "serially/compose/"
48 }
50 ignoringErr $ bgraph "charts/results.csv" "composition-scaling" "time"
51 $ cfg
52 { chartTitle = Just "Streamly composition scaling (time)"
53 , classifyBenchmark = fmap ("Streamly",) . stripPrefix "serially/compose-"
54 }