Skip to content

Commit 35476b7

Browse files
committed
Use tagged templates whenever possible in perf tests
1 parent 4fdbf6c commit 35476b7

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

test/perf.test.mjs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ describe('performance', () => {
2424
function go(count) {
2525
const statics = [
2626
'\n<div id=app'+(++count)+' data-loading="true">\n\t<h1>Hello World</h1>\n\t<ul class="items" id=', '>\n\t',
27-
'\n\t</ul>\n\t\n\t<', ' name="foo" />\n\t<', ' name="other">content</', '>\n\n</div>'
27+
'\n\t</ul>\n\t\n\t<', ' name="foo" />\n\t<', ' name="other">content<//>\n\n</div>'
2828
];
2929
return html(
3030
statics,
3131
`id${count}`,
32-
html(['<li data-id="','">', '</li>'], 'i'+count, 'some text #'+count),
33-
Foo, Foo, Foo
32+
html`<li data-id="${'i' + count}">${'some text #' + count}</li>`,
33+
Foo, Foo
3434
);
3535
}
3636
let now = performance.now();
@@ -50,18 +50,18 @@ describe('performance', () => {
5050
test('usage', () => {
5151
const results = [];
5252
const Foo = ({ name }) => html`<div class="foo">${name}</div>`;
53-
const statics = [
54-
'\n<div id=app data-loading="true">\n\t<h1>Hello World</h1>\n\t<ul class="items" id=', '>\n\t',
55-
'\n\t</ul>\n\t\n\t<', ' name="foo" />\n\t<', ' name="other">content</', '>\n\n</div>'
56-
];
5753
let count = 0;
5854
function go(count) {
59-
return html(
60-
statics,
61-
`id${count}`,
62-
html(['<li data-id="','">', '</li>'], 'i'+count, 'some text #'+count),
63-
Foo, Foo, Foo
64-
);
55+
return html`
56+
<div id="app" data-loading="true">
57+
<h1>Hello World</h1>
58+
<ul class="items" id=${`id${count}`}>
59+
${html`<li data-id="${'i' + count}">${'some text #' + count}</li>`}
60+
</ul>
61+
<${Foo} name="foo" />
62+
<${Foo} name="other">content<//>
63+
</div>
64+
`;
6565
}
6666
let now = performance.now();
6767
const start = now;

0 commit comments

Comments
 (0)