add benchmarkable test case

This commit is contained in:
Matthew Griffith 2020-07-28 22:34:46 -04:00
parent a1c0154534
commit 112c74253a
7 changed files with 35051 additions and 0 deletions

53
testcases/bench/Main.elm Normal file
View File

@ -0,0 +1,53 @@
module Main exposing (main)
{-| -}
import Benchmark exposing (..)
import Benchmark.Runner exposing (BenchmarkProgram, program)
import Html
type MyType
= Zero
| One Int
| Two String String
values =
[ Zero
, One 5
, Two "Two" "two"
]
many =
List.repeat 1000 values
|> List.concat
addMyType mine sum =
case mine of
Zero ->
sum
One i ->
i + sum
Two _ _ ->
sum
main : BenchmarkProgram
main =
Benchmark.Runner.program suite
suite : Benchmark
suite =
describe "List of MyType"
[ -- nest as many descriptions as you like
describe "slice"
[ benchmark "sum 1000 entities in a list" <|
\_ -> List.foldl addMyType 0 many
]
]

29
testcases/bench/elm.json Normal file
View File

@ -0,0 +1,29 @@
{
"type": "application",
"source-directories": [
"."
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm-explorations/benchmark": "1.0.1"
},
"indirect": {
"BrianHicks/elm-trend": "2.1.3",
"Skinney/murmur3": "2.0.8",
"elm/json": "1.1.3",
"elm/regex": "1.0.0",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.2",
"mdgriffith/style-elements": "5.0.1"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}

14835
testcases/bench/output/elm.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
<html>
<head>
<meta charset="UTF-8">
<title>Main</title>
<script src="output/elm.opt.js"></script>
</head>
<body>
<div id="myapp"></div>
<script>
var app = Elm.Main.init({
node: document.getElementById('myapp')
});
</script>
</body>
</html>

View File

@ -0,0 +1,18 @@
<html>
<head>
<meta charset="UTF-8">
<title>Main</title>
<script src="output/elm.opt.transformed.js"></script>
</head>
<body>
<div id="myapp"></div>
<script>
var app = Elm.Main.init({
node: document.getElementById('myapp')
});
</script>
</body>
</html>