perf: add benchmarks for IV and render3 with functions (tree) (#20855)

PR Close #20855
This commit is contained in:
Marc Laval 2017-12-12 14:44:51 +01:00 committed by Igor Minar
parent 0867e85163
commit f75296e04e
9 changed files with 172 additions and 0 deletions

View File

@ -65,6 +65,15 @@ describe('largetable benchmark perf', () => {
}).then(done, done.fail);
});
it('should run for iv', (done) => {
runTableBenchmark({
id: `largeTable.iv.${worker.id}`,
url: 'all/benchmarks/src/largetable/iv/index.html',
ignoreBrowserSynchronization: true,
worker: worker
}).then(done, done.fail);
});
it('should run for the baseline', (done) => {
runTableBenchmark({
id: `largeTable.baseline.${worker.id}`,

View File

@ -32,6 +32,13 @@ describe('largetable benchmark spec', () => {
});
});
it('should work for iv', () => {
testTableBenchmark({
url: 'all/benchmarks/src/largetable/iv/index.html',
ignoreBrowserSynchronization: true,
});
});
it('should work for the baseline', () => {
testTableBenchmark({
url: 'all/benchmarks/src/largetable/baseline/index.html',

View File

@ -55,6 +55,18 @@ export const Benchmarks: Benchmark[] = [
buttons: CreateDestroyDetectChangesButtons,
ignoreBrowserSynchronization: true,
},
{
id: `deepTree.ng2.render3_function`,
url: 'all/benchmarks/src/tree/render3_function/index.html',
buttons: CreateDestroyDetectChangesButtons,
ignoreBrowserSynchronization: true,
},
{
id: `deepTree.iv`,
url: 'all/benchmarks/src/tree/iv/index.html',
buttons: CreateDestroyDetectChangesButtons,
ignoreBrowserSynchronization: true,
},
{
id: `deepTree.baseline`,
url: 'all/benchmarks/src/tree/baseline/index.html',

View File

@ -0,0 +1,31 @@
<!doctype html>
<html>
<body>
<h2>Params</h2>
<form>
Cols:
<input type="number" name="cols" placeholder="cols" value="40">
<br>
Rows:
<input type="number" name="rows" placeholder="rows" value="200">
<br>
<button>Apply</button>
</form>
<h2>IV Largetable Benchmark</h2>
<p>
<button id="destroyDom">destroyDom</button>
<button id="createDom">createDom</button>
<button id="updateDomProfile">profile updateDom</button>
<button id="createDomProfile">profile createDom</button>
</p>
<div>
<largetable id="root"></largetable>
</div>
<script type="text/javascript" src="largetable.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,30 @@
<!doctype html>
<html>
<body>
<h2>Params</h2>
<form>
Depth:
<input type="number" name="depth" placeholder="depth" value="9">
<br>
<button>Apply</button>
</form>
<h2>IV Tree Benchmark</h2>
<p>
<button id="destroyDom">destroyDom</button>
<button id="createDom">createDom</button>
<button id="detectChanges">detectChanges</button>
<button id="updateDomProfile">profile updateDom</button>
<button id="createDomProfile">profile createDom</button>
<button id="detectChangesProfile">profile detectChanges</button>
</p>
<div>
Change detection runs:<span id="numberOfChecks"></span>
</div>
<div id="root"></div>
<script type="text/javascript" src="tree.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,36 @@
<!doctype html>
<html>
<body>
<h2>Params</h2>
<form>
Depth:
<input type="number" name="depth" placeholder="depth" value="9">
<br>
<button>Apply</button>
</form>
<h2>Render3 Tree Benchmark with functions</h2>
<p>
<button id="destroyDom">destroyDom</button>
<button id="createDom">createDom</button>
<button id="detectChanges">detectChanges</button>
<button id="updateDomProfile">profile updateDom</button>
<button id="createDomProfile">profile createDom</button>
<button id="detectChangesProfile">profile detectChanges</button>
</p>
<div>
Change detection runs:<span id="numberOfChecks"></span>
</div>
<div>
<tree id="root"></tree>
</div>
<script>
var mainUrl = window.location.search.split(/[?&]main=([^&]+)/)[1]
|| '../../bootstrap_ng2.js';
document.write('<script src="' + mainUrl + '">\u003c/script>');
</script>
</body>
</html>

View File

@ -0,0 +1,29 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {renderComponent} from '@angular/core/src/render3/index';
import {bindAction, profile} from '../../util';
import {TreeFunction, createDom, destroyDom, detectChanges} from '../render3/tree';
function noop() {}
export function main() {
let component: TreeFunction;
if (typeof window !== 'undefined') {
component = renderComponent(TreeFunction, {renderer: document});
bindAction('#createDom', () => createDom(component));
bindAction('#destroyDom', () => destroyDom(component));
bindAction('#detectChanges', () => detectChanges(component));
bindAction(
'#detectChangesProfile', profile(() => detectChanges(component), noop, 'detectChanges'));
bindAction('#updateDomProfile', profile(() => createDom(component), noop, 'update'));
bindAction(
'#createDomProfile',
profile(() => createDom(component), () => destroyDom(component), 'create'));
}
}