File tree Expand file tree Collapse file tree 5 files changed +2885
-2
lines changed Expand file tree Collapse file tree 5 files changed +2885
-2
lines changed Original file line number Diff line number Diff line change
1
+ module Bench.Data.List where
2
+
3
+ import Prelude
4
+ import Control.Monad.Eff (Eff )
5
+ import Control.Monad.Eff.Console (CONSOLE , log )
6
+ import Performance.Minibench (bench )
7
+
8
+ import Data.List as L
9
+
10
+ benchList :: Eff (console :: CONSOLE ) Unit
11
+ benchList = do
12
+ log " map"
13
+ log " ---"
14
+ benchMap
15
+
16
+ where
17
+
18
+ benchMap = do
19
+ let nats = L .range 0 999999
20
+ mapFn = map (_ + 1 )
21
+ list1000 = L .take 1000 nats
22
+ list2000 = L .take 2000 nats
23
+ list5000 = L .take 5000 nats
24
+ list10000 = L .take 10000 nats
25
+ list100000 = L .take 100000 nats
26
+
27
+ log " map: empty list"
28
+ let emptyList = L.Nil
29
+ bench \_ -> mapFn emptyList
30
+
31
+ log " map: singleton list"
32
+ let singletonList = L.Cons 0 L.Nil
33
+ bench \_ -> mapFn singletonList
34
+
35
+ log $ " map: list (" <> show (L .length list1000) <> " elems)"
36
+ bench \_ -> mapFn list1000
37
+
38
+ log $ " map: list (" <> show (L .length list2000) <> " elems)"
39
+ bench \_ -> mapFn list2000
40
+
41
+ log $ " map: list (" <> show (L .length list5000) <> " elems)"
42
+ bench \_ -> mapFn list5000
43
+
44
+ log $ " map: list (" <> show (L .length list10000) <> " elems)"
45
+ bench \_ -> mapFn list10000
46
+
47
+ log $ " map: list (" <> show (L .length list100000) <> " elems)"
48
+ bench \_ -> mapFn list100000
Original file line number Diff line number Diff line change
1
+ module Bench.Main where
2
+
3
+ import Prelude
4
+ import Control.Monad.Eff (Eff )
5
+ import Control.Monad.Eff.Console (CONSOLE , log )
6
+
7
+ import Bench.Data.List (benchList )
8
+
9
+ main :: Eff (console :: CONSOLE ) Unit
10
+ main = do
11
+ log " List"
12
+ log " ===="
13
+ benchList
Original file line number Diff line number Diff line change 31
31
"purescript-arrays" : " ^4.0.0" ,
32
32
"purescript-assert" : " ^3.0.0" ,
33
33
"purescript-console" : " ^3.0.0" ,
34
- "purescript-math" : " ^2.0.0"
34
+ "purescript-math" : " ^2.0.0" ,
35
+ "purescript-minibench" : " ^1.0.1"
35
36
}
36
37
}
You can’t perform that action at this time.
0 commit comments