Skip to content

Commit ddfa6de

Browse files
committed
Add TodoMVC for dart2js & dart2wasm
This is a Jaspr Dart Web application compiled with dart2js and dart2wasm. The source is from [0] and was compiled with a modified Jaspr CLI tool (see PR in [1]) using the following commands: ``` % rm -rf build % dart run --resident <jaspr>/packages/jaspr_cli/bin/jaspr.dart build -O4 --extra-js-compiler-option=--no-minify ``` ``` % rm -rf build % dart run --resident <jaspr>/packages/jaspr_cli/bin/jaspr.dart build -O4 --extra-wasm-compiler-option=--no-strip-wasm --experimental-wasm ``` The relevant files in `build/jaspr/*` were copied to the Speedometer benchmark folders. Used Dart SDK version is: 3.8.0-edge.4c8aedcb57fe678e6d30acfdc021aa9888576638 Before landing we should figure out: * do we want both dart2js and dart2wasm? * do we want -O2 or -O4? * can we rely on `js-string` builtin to be evailable or not? [0] https://github.com/mkustermann/todomvc [1] schultek/jaspr#397
1 parent c760d16 commit ddfa6de

File tree

15 files changed

+22396
-0
lines changed

15 files changed

+22396
-0
lines changed

resources/tests.mjs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,63 @@ Suites.push({
11131113
],
11141114
});
11151115

1116+
Suites.push({
1117+
name: "TodoMVC-Dart2JS",
1118+
url: "resources/todomvc/dart2js-jaspr/index.html",
1119+
tags: ["todomvc"],
1120+
async prepare(page) {
1121+
(await page.waitForElement(".new-todo")).focus();
1122+
},
1123+
tests: [
1124+
new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => {
1125+
const newTodo = page.querySelector(".new-todo");
1126+
for (let i = 0; i < numberOfItemsToAdd; i++) {
1127+
newTodo.setValue(getTodoText("ja", i));
1128+
newTodo.dispatchEvent("change");
1129+
newTodo.enter("keypress");
1130+
}
1131+
}),
1132+
new BenchmarkTestStep("CompletingAllItems", (page) => {
1133+
const checkboxes = page.querySelectorAll(".toggle");
1134+
for (let i = 0; i < numberOfItemsToAdd; i++)
1135+
checkboxes[i].click();
1136+
}),
1137+
new BenchmarkTestStep("DeletingAllItems", (page) => {
1138+
const deleteButtons = page.querySelectorAll(".destroy");
1139+
for (let i = numberOfItemsToAdd - 1; i >= 0; i--)
1140+
deleteButtons[i].click();
1141+
}),
1142+
],
1143+
});
1144+
Suites.push({
1145+
name: "TodoMVC-Dart2Wasm",
1146+
url: "resources/todomvc/dart2wasm-jaspr/index.html",
1147+
tags: ["todomvc"],
1148+
async prepare(page) {
1149+
(await page.waitForElement(".new-todo")).focus();
1150+
},
1151+
tests: [
1152+
new BenchmarkTestStep(`Adding${numberOfItemsToAdd}Items`, (page) => {
1153+
const newTodo = page.querySelector(".new-todo");
1154+
for (let i = 0; i < numberOfItemsToAdd; i++) {
1155+
newTodo.setValue(getTodoText("ja", i));
1156+
newTodo.dispatchEvent("change");
1157+
newTodo.enter("keypress");
1158+
}
1159+
}),
1160+
new BenchmarkTestStep("CompletingAllItems", (page) => {
1161+
const checkboxes = page.querySelectorAll(".toggle");
1162+
for (let i = 0; i < numberOfItemsToAdd; i++)
1163+
checkboxes[i].click();
1164+
}),
1165+
new BenchmarkTestStep("DeletingAllItems", (page) => {
1166+
const deleteButtons = page.querySelectorAll(".destroy");
1167+
for (let i = numberOfItemsToAdd - 1; i >= 0; i--)
1168+
deleteButtons[i].click();
1169+
}),
1170+
],
1171+
});
1172+
11161173
Object.freeze(Suites);
11171174
Suites.forEach((suite) => {
11181175
if (!suite.tags)
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
hr {
2+
margin: 20px 0;
3+
border: 0;
4+
border-top: 1px dashed #c5c5c5;
5+
border-bottom: 1px dashed #f7f7f7;
6+
}
7+
8+
.learn a {
9+
font-weight: normal;
10+
text-decoration: none;
11+
color: #b83f45;
12+
}
13+
14+
.learn a:hover {
15+
text-decoration: underline;
16+
color: #787e7e;
17+
}
18+
19+
.learn h3,
20+
.learn h4,
21+
.learn h5 {
22+
margin: 10px 0;
23+
font-weight: 500;
24+
line-height: 1.2;
25+
color: #000;
26+
}
27+
28+
.learn h3 {
29+
font-size: 24px;
30+
}
31+
32+
.learn h4 {
33+
font-size: 18px;
34+
}
35+
36+
.learn h5 {
37+
margin-bottom: 0;
38+
font-size: 14px;
39+
}
40+
41+
.learn ul {
42+
padding: 0;
43+
margin: 0 0 30px 25px;
44+
}
45+
46+
.learn li {
47+
line-height: 20px;
48+
}
49+
50+
.learn p {
51+
font-size: 15px;
52+
font-weight: 300;
53+
line-height: 1.3;
54+
margin-top: 0;
55+
margin-bottom: 0;
56+
}
57+
58+
#issue-count {
59+
display: none;
60+
}
61+
62+
.quote {
63+
border: none;
64+
margin: 20px 0 60px 0;
65+
}
66+
67+
.quote p {
68+
font-style: italic;
69+
}
70+
71+
.quote p:before {
72+
content: '“';
73+
font-size: 50px;
74+
opacity: .15;
75+
position: absolute;
76+
top: -20px;
77+
left: 3px;
78+
}
79+
80+
.quote p:after {
81+
content: '”';
82+
font-size: 50px;
83+
opacity: .15;
84+
position: absolute;
85+
bottom: -42px;
86+
right: 3px;
87+
}
88+
89+
.quote footer {
90+
position: absolute;
91+
bottom: -40px;
92+
right: 0;
93+
}
94+
95+
.quote footer img {
96+
border-radius: 3px;
97+
}
98+
99+
.quote footer a {
100+
margin-left: 5px;
101+
vertical-align: middle;
102+
}
103+
104+
.speech-bubble {
105+
position: relative;
106+
padding: 10px;
107+
background: rgba(0, 0, 0, .04);
108+
border-radius: 5px;
109+
}
110+
111+
.speech-bubble:after {
112+
content: '';
113+
position: absolute;
114+
top: 100%;
115+
right: 30px;
116+
border: 13px solid transparent;
117+
border-top-color: rgba(0, 0, 0, .04);
118+
}
119+
120+
.learn-bar > .learn {
121+
position: absolute;
122+
width: 272px;
123+
top: 8px;
124+
left: -300px;
125+
padding: 10px;
126+
border-radius: 5px;
127+
background-color: rgba(255, 255, 255, .6);
128+
transition-property: left;
129+
transition-duration: 500ms;
130+
}
131+
132+
@media (min-width: 899px) {
133+
.learn-bar {
134+
width: auto;
135+
padding-left: 300px;
136+
}
137+
138+
.learn-bar > .learn {
139+
left: 8px;
140+
}
141+
}
2.53 KB
Binary file not shown.

0 commit comments

Comments
 (0)