on bac26fc help sign in
streamly/benchmark/ChartLinear.hs
43 lines 1.5 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) ->
19 putStrLn "Failed. Skipping.")
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 "compose" `isPrefixOf` b || "/concat" `isSuffixOf` b
30 then Nothing
31 else Just ("Streamly", last $ splitOn "/" b)
32 }
34 ignoringErr $ bgraph "charts/results.csv" "composition" "time" $ cfg
35 { chartTitle = Just "Streamly composition performance (time)"
36 , classifyBenchmark = fmap ("Streamly",) . stripPrefix "compose/"
37 }
39 ignoringErr $ bgraph "charts/results.csv" "composition-scaling" "time"
40 $ cfg
41 { chartTitle = Just "Streamly composition scaling (time)"
42 , classifyBenchmark = fmap ("Streamly",) . stripPrefix "compose-"
43 }