on master help sign in
Add small if benchmark, fix messages
3434bbdjmite
bench/CompilerBenchmarks.elm+2−1
@@ -37,7 +37,8 @@ mySuite =
37 , Benchmark.bench1 "Access 10-constructor Type 200 times: " SmallCtorBench.sumFieldsList smallCtorData200
37 , Benchmark.bench1 "Access 10-constructor Type 200 times: " SmallCtorBench.sumFieldsList smallCtorData200
38
38
39 , Benchmark.bench1 "Tail-recursive if function, called 200 times: " IfBench.tailRecSum indices200
39 , Benchmark.bench1 "Tail-recursive if function, called 200 times: " IfBench.tailRecSum indices200
40− , Benchmark.bench1 "Tail-recursive if function, called 200 times: " IfBench.manyConditionalSum indices200
40+ , Benchmark.bench1 "If expression with 20 branches, called 200 times: " IfBench.manyConditionalSum indices200
41+ , Benchmark.bench1 "If expression with 4 branches, called 200 times: " IfBench.fewConditionalSum indices200
41
42
42 , Benchmark.bench1 "Pattern match 18-levels deep, use all values, 200 times " PatternMatchBench.deepMatchSum nestedData200
43 , Benchmark.bench1 "Pattern match 18-levels deep, use all values, 200 times " PatternMatchBench.deepMatchSum nestedData200
43 , Benchmark.bench1 "Pattern match 18-levels deep, 16 wildcards, 200 times " PatternMatchBench.wildcardMatchSum nestedData200
44 , Benchmark.bench1 "Pattern match 18-levels deep, 16 wildcards, 200 times " PatternMatchBench.wildcardMatchSum nestedData200
bench/src/IfBench.elm+30
@@ -39,6 +39,32 @@ manyConditionFunction i =
39 59.0 + (toFloat i)
39 59.0 + (toFloat i)
40 | (i == 105) ->
40 | (i == 105) ->
41 69.0 + (toFloat i)
41 69.0 + (toFloat i)
42+ | (i == 106) ->
43+ 39.0 + (toFloat i)
44+ | (i == 107) ->
45+ 38.0 + (toFloat i)
46+ | (i == 108) ->
47+ 49.0 + (toFloat i)
48+ | (i == 109) ->
49+ 59.0 + (toFloat i)
50+ | (i == 110) ->
51+ 69.0 + (toFloat i)
52+ | (i == 111) ->
53+ 39.0 + (toFloat i)
54+ | (i == 115) ->
55+ 69.0 + (toFloat i)
56+ | otherwise ->
57+ toFloat i
58+
59+
60+fewConditionFunction i =
61+ if
62+ | i <= 0 ->
63+ 30.0 + (toFloat i)
64+ | (i == 104) ->
65+ 59.0 + (toFloat i)
66+ | (i == 105) ->
67+ 69.0 + (toFloat i)
42 | otherwise ->
68 | otherwise ->
43 toFloat i
69 toFloat i
44
70
@@ -48,4 +74,8 @@ tailRecSum intList =
48
74
49manyConditionalSum intList =
75manyConditionalSum intList =
50 List.foldr (\i sumSoFar -> sumSoFar + manyConditionFunction i ) 0.0 intList
76 List.foldr (\i sumSoFar -> sumSoFar + manyConditionFunction i ) 0.0 intList
77+
78+
79+fewConditionalSum intList =
80+ List.foldr (\i sumSoFar -> sumSoFar + fewConditionFunction i ) 0.0 intList
51
81