refactor(benchmarks): add cloud reporter, add params
- adds console and cloud reporter (via Google BigQuery). - makes parameters of tests explicit and modifiable. - removes `detect` and `ignoreGc` mode from benchpress as these can result in unstable numbers.
This commit is contained in:
@ -2,8 +2,19 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<button id="instantiate">ElementInjector.instantiate</button>
|
||||
<button id="instantiateDirectives">ElementInjector.instantiateDirectives</button>
|
||||
<h2>Params</h2>
|
||||
<form>
|
||||
Iterations:
|
||||
<input type="number" name="iterations" placeholder="iterations" value="20000">
|
||||
<br>
|
||||
<button>Apply</button>
|
||||
</form>
|
||||
|
||||
<h2>Actions</h2>
|
||||
<p>
|
||||
<button id="instantiate">instantiate</button>
|
||||
<button id="instantiateDirectives">instantiateDirectives</button>
|
||||
</p>
|
||||
|
||||
$SCRIPTS$
|
||||
</body>
|
||||
|
@ -1,10 +1,9 @@
|
||||
import {reflector} from 'reflection/reflection';
|
||||
import {Injector} from 'di/di';
|
||||
import {ProtoElementInjector} from 'core/compiler/element_injector';
|
||||
import {document, DOM} from 'facade/dom';
|
||||
import {getIntParameter, bindAction} from 'e2e_test_lib/benchmark_util';
|
||||
|
||||
var count = 0;
|
||||
var ITERATIONS = 20000;
|
||||
|
||||
function setupReflector() {
|
||||
reflector.registerType(A, {
|
||||
@ -25,6 +24,8 @@ function setupReflector() {
|
||||
}
|
||||
|
||||
export function main() {
|
||||
var iterations = getIntParameter('iterations');
|
||||
|
||||
setupReflector();
|
||||
var appInjector = new Injector([]);
|
||||
|
||||
@ -32,22 +33,22 @@ export function main() {
|
||||
var proto = new ProtoElementInjector(null, 0, bindings);
|
||||
var elementInjector = proto.instantiate(null,null);
|
||||
|
||||
function instantiate (_) {
|
||||
for (var i = 0; i < ITERATIONS; ++i) {
|
||||
function instantiate () {
|
||||
for (var i = 0; i < iterations; ++i) {
|
||||
var ei = proto.instantiate(null, null);
|
||||
ei.instantiateDirectives(appInjector, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
function instantiateDirectives (_) {
|
||||
for (var i = 0; i < ITERATIONS; ++i) {
|
||||
function instantiateDirectives () {
|
||||
for (var i = 0; i < iterations; ++i) {
|
||||
elementInjector.clearDirectives();
|
||||
elementInjector.instantiateDirectives(appInjector, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
DOM.on(DOM.querySelector(document, '#instantiate'), 'click', instantiate);
|
||||
DOM.on(DOM.querySelector(document, '#instantiateDirectives'), 'click', instantiateDirectives);
|
||||
bindAction('#instantiate', instantiate);
|
||||
bindAction('#instantiateDirectives', instantiateDirectives);
|
||||
}
|
||||
|
||||
class A {
|
||||
|
Reference in New Issue
Block a user