@@ -31,26 +31,16 @@ data BenchType
41 | Concurrent
35 | Concurrent
42 | Parallel
36 | Parallel
43 | Adaptive
37 | Adaptive
44− | FoldO1Space
38+ | Compare String
48 | Standard String
39 | Standard String
49 deriving Show
40 deriving Show
51data Options = Options
42data Options = Options
52 { genGraphs :: Bool
43 { genGraphs :: Bool
54 , benchType :: BenchType
44 , benchType :: BenchType
55 } deriving Show
45 } deriving Show
@@ -60,10 +50,6 @@ setGenGraphs val = do
60 (args, opts) <- get
50 (args, opts) <- get
61 put (args, opts { genGraphs = val })
51 put (args, opts { genGraphs = val })
65− put (args, opts { groupDiff = val })
67setBenchType val = do
53setBenchType val = do
68 (args, opts) <- get
54 (args, opts) <- get
69 put (args, opts { benchType = val })
55 put (args, opts { benchType = val })
@@ -87,20 +73,11 @@ parseBench = do
87 Just "parserD" -> setBenchType ParserD
73 Just "parserD" -> setBenchType ParserD
88 Just "parserK" -> setBenchType ParserK
74 Just "parserK" -> setBenchType ParserK
89 Just "parser" -> setBenchType Parser
75 Just "parser" -> setBenchType Parser
90− Just "base" -> setBenchType Base
91 Just "fileio" -> setBenchType FileIO
76 Just "fileio" -> setBenchType FileIO
92− Just "array-cmp" -> setBenchType ArrayCmp
93− Just "array" -> setBenchType Array
94− Just "unpinned-array" -> setBenchType UnpinnedArray
95− Just "small-array" -> setBenchType SmallArray
96− Just "prim-array" -> setBenchType PrimArray
97 Just "concurrent" -> setBenchType Concurrent
77 Just "concurrent" -> setBenchType Concurrent
98 Just "parallel" -> setBenchType Parallel
78 Just "parallel" -> setBenchType Parallel
99 Just "adaptive" -> setBenchType Adaptive
79 Just "adaptive" -> setBenchType Adaptive
100− Just "fold-o-1-space" -> setBenchType FoldO1Space
80+ Just str | "_cmp" `isSuffixOf` str -> setBenchType (Compare str)
101− Just "fold-o-n-heap" -> setBenchType FoldOnHeap
102− Just "unfold-o-1-space" -> setBenchType UnfoldO1Space
103− Just "unfold-o-n-space" -> setBenchType UnfoldOnSpace
104 Just str -> setBenchType (Standard str)
81 Just str -> setBenchType (Standard str)
105 Nothing -> do
82 Nothing -> do
106 liftIO $ putStrLn "please provide a benchmark type "
83 liftIO $ putStrLn "please provide a benchmark type "
@@ -119,7 +96,6 @@ parseOptions = do
119 parseOpt opt =
96 parseOpt opt =
120 case opt of
97 case opt of
121 "--graphs" -> setGenGraphs True
98 "--graphs" -> setGenGraphs True
122− "--group-diff" -> setGroupDiff True
123 "--benchmark" -> parseBench
99 "--benchmark" -> parseBench
124 str -> do
100 str -> do
125 liftIO $ putStrLn $ "Unrecognized option " <> str
101 liftIO $ putStrLn $ "Unrecognized option " <> str
@@ -239,71 +215,21 @@ makeGraphs name cfg@Config{..} inputFile =
240------------------------------------------------------------------------------
216------------------------------------------------------------------------------
242−showArrayComparisons Options{..} cfg inp out =
218+showComparisons Options{..} cfg inp out =
243− let cfg' = cfg { classifyBenchmark = classifyArray }
219+ let cfg1 = cfg { classifyBenchmark = classifyComparison }
244− in if genGraphs
220+ in if genGraphs
245− then ignoringErr $ graph inp "Arrays Comparison"
221+ then ignoringErr $ graph inp "comparison"
246− cfg' { outputDir = Just out
222+ cfg1 { outputDir = Just out
247 , presentation = Groups Absolute
223 , presentation = Groups Absolute
249− else ignoringErr $ report inp Nothing cfg'
225+ else ignoringErr $ report inp Nothing cfg1
253− classifyArray b
229+ classifyComparison b = Just $
254− -- SmallArray uses a small number of elements therefore cannot be
230+ ( takeWhile (/= '/') b
255− -- compared
231+ , dropWhile (== '/') $ dropWhile (/= '/') b
256− -- | "SmallArray/" `isPrefixOf` b = ("SmallArray",) <$> stripPrefix "SmallArray/" b
232+ )
257− | "Data.Prim.Array/" `isPrefixOf` b = ("Data.Prim.Array",) <$> stripPrefix "Data.Prim.Array/" b
258− | "Data.Array/" `isPrefixOf` b = ("Data.Array",) <$> stripPrefix "Data.Array/" b
259− | "array/" `isPrefixOf` b = ("array",) <$> stripPrefix "array/" b
260− | otherwise = Nothing
262−------------------------------------------------------------------------------
263−-- Reports/Charts for base streams
264−------------------------------------------------------------------------------
266−showStreamDVsK Options{..} cfg inp out =
267− let cfg' = cfg { classifyBenchmark = classifyBase }
269− then ignoringErr $ graph inp "streamD-vs-streamK"
270− cfg' { outputDir = Just out
271− , presentation = Groups Absolute
273− else ignoringErr $ report inp Nothing cfg'
278− | "streamD/" `isPrefixOf` b = ("streamD",) <$> stripPrefix "streamD/" b
279− | "streamK/" `isPrefixOf` b = ("streamK",) <$> stripPrefix "streamK/" b
280− | otherwise = Nothing
282−showStreamD Options{..} cfg inp out =
283− let cfg' = cfg { classifyBenchmark = classifyStreamD }
285− then ignoringErr $ graph inp "streamD"
286− cfg' {outputDir = Just out}
287− else ignoringErr $ report inp Nothing cfg'
292− | "streamD/" `isPrefixOf` b = ("streamD",) <$> stripPrefix "streamD/" b
293− | otherwise = Nothing
295−showStreamK Options{..} cfg inp out =
296− let cfg' = cfg { classifyBenchmark = classifyStreamK }
298− then ignoringErr $ graph inp "streamK"
299− cfg' {outputDir = Just out}
300− else ignoringErr $ report inp Nothing cfg'
305− | "streamK/" `isPrefixOf` b = ("streamK",) <$> stripPrefix "streamK/" b
306− | otherwise = Nothing
308------------------------------------------------------------------------------
234------------------------------------------------------------------------------
309-- text reports
235-- text reports
@@ -385,30 +311,6 @@ main = do
385 (makeGraphs "fileIO")
311 (makeGraphs "fileIO")
386 "charts/fileio/results.csv"
312 "charts/fileio/results.csv"
387 "charts/fileio"
313 "charts/fileio"
388− Array -> benchShow opts cfg
389− { title = Just "Array" }
390− (makeGraphs "array")
391− "charts/array/results.csv"
393− UnpinnedArray -> benchShow opts cfg
394− { title = Just "Unpinned Array" }
395− (makeGraphs "unpinned-array")
396− "charts/unpinned-array/results.csv"
397− "charts/unpinned-array"
398− SmallArray -> benchShow opts cfg
399− { title = Just "Small Array" }
400− (makeGraphs "small-array")
401− "charts/small-array/results.csv"
402− "charts/small-array"
403− PrimArray -> benchShow opts cfg
404− { title = Just "Prim Array" }
405− (makeGraphs "prim-array")
406− "charts/prim-array/results.csv"
408− ArrayCmp -> showArrayComparisons opts cfg
409− { title = Just "Arrays Comparison" }
410− "charts/array-cmp/results.csv"
412 Concurrent -> benchShow opts cfg
314 Concurrent -> benchShow opts cfg
413 { title = Just "Concurrent Ops" }
315 { title = Just "Concurrent Ops" }
414 (makeGraphs "Concurrent")
316 (makeGraphs "Concurrent")
@@ -424,39 +326,10 @@ main = do
424 (makeGraphs "adaptive")
326 (makeGraphs "adaptive")
425 "charts/adaptive/results.csv"
327 "charts/adaptive/results.csv"
426 "charts/adaptive"
328 "charts/adaptive"
427− Base -> do
329+ Compare str -> showComparisons opts cfg
428− let cfg' = cfg { title = Just "Base stream" }
430− then showStreamDVsK opts cfg'
431− "charts/base/results.csv"
434− showStreamD opts cfg'
435− "charts/base/results.csv"
437− showStreamK opts cfg'
438− "charts/base/results.csv"
440− FoldO1Space -> benchShow opts cfg
441− { title = Just "Fold O(1) Space" }
330+ { title = Just $ str }
442− (makeGraphs "fold-o-1-space")
443− "charts/fold-o-1-space/results.csv"
444− "charts/fold-o-1-space"
445− FoldOnHeap -> benchShow opts cfg
446− { title = Just "Fold O(n) Heap" }
447− (makeGraphs "fold-o-n-heap")
448− "charts/fold-o-n-heap/results.csv"
331+ ("charts/" ++ str ++ "/results.csv")
449− "charts/fold-o-n-heap"
332+ ("charts/" ++ str)
450− UnfoldO1Space -> benchShow opts cfg
451− { title = Just "Unfold O(1) Space" }
452− (makeGraphs "unfold-o-1-space")
453− "charts/unfold-o-1-space/results.csv"
454− "charts/unfold-o-1-space"
455− UnfoldOnSpace -> benchShow opts cfg
456− { title = Just "Unfold O(n) Space" }
457− (makeGraphs "unfold-o-n-space")
458− "charts/unfold-o-n-space/results.csv"
459− "charts/unfold-o-n-space"
460 Standard str -> benchShow opts cfg
333 Standard str -> benchShow opts cfg
461 { title = Just str }
334 { title = Just str }
462 (makeGraphs str)
335 (makeGraphs str)