@@ -5,6 +5,7 @@ import Task exposing (Task, andThen)
55import Text
66import Array
77import Random
8+import Dict
89import Time
910
1011import LargeDictionary
@@ -19,6 +20,7 @@ import CtorBench
1920import SmallCtorBench
2021import PatternMatchBench
2122import IfBench
23+import DictBench
2224
2325{-| Compile this with --output=Benchmarks.html to generate
2426 a webpage, which runs the benchmarks and shows the results.
@@ -53,6 +55,10 @@ mySuite =
5355 , Benchmark.bench1 "Array custom foldl, 500 elems: " ArrayBench.customFoldrMeanStddev array500
5456 , Benchmark.bench3 "Array square nth elem, 500 elems: " ArrayBench.updateNRandomIndices (\x -> x*x) indices200 array500
5557
58+ , Benchmark.bench1 "Dict native foldr, 500 elems: " DictBench.foldrMeanStddev dict500
59+ , Benchmark.bench1 "Dict native foldl, 500 elems: " DictBench.foldlMeanStddev dict500
60+ , Benchmark.bench3 "Dict square nth elem, 500 elems: " DictBench.updateNRandomIndices (\x -> x*x) indices200 dict500
61+
5662 , Benchmark.bench1 "List native foldr, 500 elems: " ListBench.foldrMeanStddev list500
5763 , Benchmark.bench1 "List native foldl, 500 elems: " ListBench.foldlMeanStddev list500
5864 , Benchmark.bench1 "List custom foldr, 500 elems: " ListBench.customFoldrMeanStddev list500
@@ -61,6 +67,7 @@ mySuite =
6167
6268 , Benchmark.bench2 "200 lookups in array of 500 elems: " ArrayBench.randomLookups indices200 (Array.fromList [1 .. 500] )
6369 , Benchmark.bench2 "200 lookups in list of 500 elems: " ListBench.randomLookups indices200 ([1 .. 500] )
70+ , Benchmark.bench2 "200 lookups in dict of 500 elems: " DictBench.randomLookups indices200 (Dict.fromList (List.map2 (,) [1 .. 500] [1 .. 500]) )
6471
6572 , Benchmark.bench1 "30s simulated animation @ 30fps: " AnimateBench.runAnimation timeSteps30s
6673 ]
@@ -120,6 +127,12 @@ seed =
120127--Pseudo-random array of 500 floating point numbers
121128array500 =
122129 (ArrayBench.randomArray floatGen 500 seed)
130+
131+
132+--Pseudo-random dictionary, indexed 0 .. 500, of 500 floating point numbers
133+dict500 =
134+ (DictBench.randomDict floatGen 500 seed)
135+
123136
124137
125138--Same contents as array500, but in list form