1module Suite exposing (main)
3import Benchmark exposing (Benchmark)
4import Benchmark.Runner exposing (BenchmarkProgram, program)
6import Element exposing (..)
7import Element.Background as Background
8import Element.Font as Font
11import Internal.Flag as Flag
12import Internal.Model as Internal
23 Benchmark.describe "dictionary"
24 [ Benchmark.benchmark "get" (\_ -> Dict.get "a" dest)
25 , Benchmark.benchmark "insert" (\_ -> Dict.insert "b" 2 dest)
29main : BenchmarkProgram
32 Benchmark.describe "sample"
43 Benchmark.describe "Flag Operations"
44 [ Benchmark.benchmark "check if present" <|
46 Flag.present Flag.height Flag.none
47 , Benchmark.benchmark "add to flagt" <|
49 Flag.add Flag.height Flag.none
54 Benchmark.describe "Gathering Attributes"
55 [ Benchmark.benchmark "existing - gatherAttrRecursive" <|
57 Internal.gatherAttrRecursive
58 (Internal.contextClasses Internal.AsEl)
61 Internal.Untransformed
64 Internal.NoNearbyChildren
65 [ Element.width Element.shrink
66 , Element.height Element.shrink
68 , Benchmark.benchmark "Simple list filterMap" <|
75 , Benchmark.benchmark "Simple list map" <|
82 , Benchmark.benchmark "Foldl base speed" <|
89 , Benchmark.benchmark "Recursive" <|
96 , Benchmark.benchmark "foldl - new record each iteration" <|
99 { attributes = "class"
105 -- we reverse first because we have to for the attr api.
111 , Benchmark.benchmark "foldl - update" <|
113 List.foldl flipFoldlUpdate
114 { attributes = "class"
120 -- we reverse first because we have to for the attr api.
126 , Benchmark.benchmark "String Concatenation" <|
136 , Benchmark.benchmark "List String Concatenation" <|
151flipFoldl result found =
152 { attributes = "class" ++ found.attributes
153 , styles = Just 1 :: found.styles
156 , has = Flag.add Flag.height found.has
160flipFoldlUpdate result found =
162 | attributes = "class" ++ found.attributes
163 , styles = Just 1 :: found.styles
164 , has = Flag.add Flag.height found.has
174 fn fst (recurse fn remain)
178 Benchmark.describe "deduplications"
179 [ Benchmark.benchmark "fold - dedup, String concat"
181 String.join ":" (foldDedup largeList)
183 , Benchmark.benchmark "fold - dedup"
187 , Benchmark.benchmark "fold - dedup - Int"
189 foldDedup largeListInt
191 , Benchmark.benchmark "Json encode"
193 Json.Encode.object largeListJson
200 dedup ( name, val ) ( cache, ls ) =
201 if Set.member name cache then
205 ( Set.insert name cache, val :: ls )
207 List.foldl dedup ( Set.empty, [] ) list
219 ( wrappingI, "elem-" ++ String.fromInt wrappingI )
231 ( "elem-" ++ String.fromInt wrappingI, "elem-" ++ String.fromInt wrappingI )
243 ( "elem-" ++ String.fromInt wrappingI, Json.Encode.string ("elem-" ++ String.fromInt wrappingI) )
248 [ Benchmark.benchmark "build 2000 elements"
250 elements 0 twoThousand
252 , Benchmark.benchmark "build 2000 html"
265 (Element.column [ spacing 8, centerX ]
266 (List.map (viewEl i) count)
270viewEl selectedIndex index =
273 (if selectedIndex == index then
280 (if selectedIndex /= index then
290 (if selectedIndex == index then
309 (List.map (viewHtmlElement i) count)
313viewHtmlElement selectedIndex index =
315 [ Html.Attributes.class
316 (if selectedIndex == index then
324 [ if selectedIndex == index then
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list