Skip to content

Commit 0413371

Browse files
authored
Merge pull request krausest#4 from krausest/master
merge master
2 parents 102141c + 839efb1 commit 0413371

38 files changed

+19465
-6092
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,15 @@ Contributions are very welcome. Please use the following rules:
261261
* Please don't commit any of the result file webdriver-ts/table.html, webdriver-ts-results/src/results.ts or webdriver-ts-results/table.html. I use to run the benchmarks after merging and publish updated (temporary) results.
262262
* The latest stable chrome can be used regarding web features and language level (babel-preset-env "last 1 chrome versions")
263263
* The vanillajs implementations and some others include code that try to approximate the repaint duration through javascript code. Implemenatations are not required to include that measurement. Remember: The real measurements are taken by the automated test driver by examining chrome timeline entries.
264-
* **Please don't over-optimize. Other contributors will review your implementation so beware of discussions ([#521](https://github.com/krausest/js-framework-benchmark/pull/521), [#519](https://github.com/krausest/js-framework-benchmark/pull/519), [#430](https://github.com/krausest/js-framework-benchmark/issues/430)) and rejection if the community finds you cheating. When are you safe?**
265-
* If the initial rendering is able to render the selection state
266-
* The implementation uses only the idiomatic style of its library
267-
* If you don't use userland hacks in your implementation like dom manipulations or request animation frame calls
268-
Tip: If you start with your implementation do not take vanillajs as the reference. It violates those rules and serves only as a performance baseline and not as a best practice implementation.
264+
* **Please don't over-optimize.** This benchmark is most useful if you apply an idiomatic style for the framework you're using. We've sharpened the rules what kind of implementation is considered correct and will add errors or notes when an implementations handles things wrongly (errors) or in a way that looks like a shortcut (notes).
265+
* The html must be identical with the one created by the reference implemenation vanillajs. It also must include all the aria-hidden attributes. Otherwise the implemenation is considered erroneous and will be marked with issue [#634](https://github.com/krausest/js-framework-benchmark/issues/634).
266+
* Keyed implementations must pass the `npm run isKeyed` test in the test driver otherwise they are erroneous. Not that this test might not be sufficient, but just necessary to be keyed (from time to time we find new loop holes). There's error [#694](https://github.com/krausest/js-framework-benchmark/issues/694) for such cases.
267+
* Using request animation frame calls in client code, especially when applied only for some benchmark operations, is considered bad style and gets note [#796](https://github.com/krausest/js-framework-benchmark/issues/796) applied. Note that frameworks are free to choose whether they use RAF of not.
268+
* Manual DOM manipulation (like setting the danger class directly on the selected row) lead to some controversial debates. Depending on the framework you're using it might be idiomatic style or not. In any case it gets note [#772](https://github.com/krausest/js-framework-benchmark/issues/772) applied.
269+
* Implementations should keep the selected rows in the state (i.e. not a flag for each row, but one reference, id or index for the table) and use that information for rendering. Keeping a selection flag for each row might be faster, but it's considered bad style. Thus those implemenations get note [#800](https://github.com/krausest/js-framework-benchmark/issues/800).
270+
* Explicit event delegation is another area where many discussions came up. Implemenations that use explicit event delegation in client code get note [#801](https://github.com/krausest/js-framework-benchmark/issues/801). Frameworks themselves are free to use event delegation.
271+
272+
Tip: If you start with your implementation do not take vanillajs as the reference. It uses direct dom manipulation (and thus has note 772) and serves only as a performance baseline but not as a best practice implementation.
269273
270274
This work is derived from a benchmark that Richard Ayotte published on https://gist.github.com/RichAyotte/a7b8780341d5e75beca7 and adds more framework and more operations. Thanks for the great work.
271275
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<table {{did-insert this.createRef}} ...attributes>
2+
</table>
3+
{{#if this.fragment}}
4+
{{#-in-element this.fragment}}
5+
<tbody>
6+
{{#each @items key="id" as |item|}}{{yield item}}{{/each}}
7+
</tbody>
8+
{{/-in-element}}
9+
{{/if}}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import Component from '@glimmer/component';
2+
import { action } from '@ember/object';
3+
import { tracked } from '@glimmer/tracking';
4+
import { scheduleOnce, cancel } from '@ember/runloop';
5+
export default class FastEachComponent extends Component {
6+
@tracked fragment = null;
7+
t1 = null;
8+
t2 = null;
9+
@action createRef(node) {
10+
this.node = node;
11+
this.fragment = document.createDocumentFragment();
12+
this.t1 = scheduleOnce('afterRender', this, this.runAppend);
13+
}
14+
willDestroy() {
15+
cancel(this.t1);
16+
clearTimeout(this.t2);
17+
}
18+
@action runAppend() {
19+
this.t2 = setTimeout(()=>{
20+
this.appendFragment();
21+
});
22+
}
23+
@action appendFragment() {
24+
this.node.appendChild(this.fragment);
25+
}
26+
}

frameworks/keyed/ember/app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6-
<title>Ember v3.20.4</title>
6+
<title>Ember v3.22.0</title>
77
<meta name="description" content="">
88

99
{{content-for "head"}}

frameworks/keyed/ember/app/templates/components/my-table.hbs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="jumbotron">
22
<div class="row">
33
<div class="col-md-6">
4-
<h1>Ember v3.20.4</h1>
4+
<h1>Ember v3.22.0</h1>
55
</div>
66
<div class="col-md-6">
77
<div class="row">
@@ -42,13 +42,9 @@
4242

4343

4444
{{#if this.data.length}}
45-
<table class="table table-hover table-striped test-data">
46-
<tbody>
47-
{{#each this.data key="id" as |item|}}
48-
<TableRow @item={{item}} @onSelect={{fn this.select item.id}} @onRemove={{fn this.remove item.id}} />
49-
{{/each}}
50-
</tbody>
51-
</table>
45+
<FastEach class="table table-hover table-striped test-data" @items={{this.data}} as |item|>
46+
<TableRow @item={{item}} @onSelect={{fn this.select item.id}} @onRemove={{fn this.remove item.id}} />
47+
</FastEach>
5248
{{/if}}
5349

5450

0 commit comments

Comments
 (0)