File: Chart.hs

package info (click to toggle)
haskell-unicode-transforms 0.4.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,312 kB
  • sloc: haskell: 786; sh: 15; makefile: 7
file content (43 lines) | stat: -rw-r--r-- 1,292 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Main where

import BenchShow
import Data.List

selectBench
    :: (SortColumn -> Maybe GroupStyle -> Either String [(String, Double)])
    -> [String]
selectBench f =
      reverse
    $ fmap fst
    $ either
        (const
            $ either error (sortOn snd)
            $ f (ColumnIndex 0) (Just PercentDiff))
        (sortOn snd)
    $ f (ColumnIndex 1) (Just PercentDiff)

main :: IO ()
main = do
    let cfg = defaultConfig
            { classifyBenchmark = \bs ->
                case stripPrefix "text-icu/" bs of
                    Just x -> Just ("ICU", x)
                    Nothing ->
                        case stripPrefix "unicode-transforms-text/" bs of
                            Just x -> Just ("unicode-transforms",x)
                            Nothing -> error "unknown benchmark"
            , selectBenchmarks = selectBench
            , selectGroups = \gs ->
                filterGroup "unicode-transforms" gs ++ filterGroup "ICU" gs
            , presentation = Groups Absolute
            }
    -- graph "results.csv" "unicode-graph" cfg
    report "results.csv" Nothing cfg

    where

    filterGroup grp gs = filter (\(name,_) -> name == grp) gs