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:
@ -4,11 +4,12 @@ library compiler_benchmark_ng10;
|
||||
import 'package:angular/angular.dart';
|
||||
import 'package:angular/application_factory.dart';
|
||||
import 'dart:html';
|
||||
|
||||
var COUNT = 30;
|
||||
import 'package:e2e_test_lib/benchmark_util.dart';
|
||||
|
||||
main() {
|
||||
|
||||
var count = getIntParameter('elements');
|
||||
|
||||
var m = new Module()
|
||||
..bind(Dir0)
|
||||
..bind(Dir1)
|
||||
@ -16,25 +17,25 @@ main() {
|
||||
..bind(Dir3)
|
||||
..bind(Dir4);
|
||||
|
||||
var templateWithBindings = loadTemplate('templateWithBindings', COUNT);
|
||||
var templateNoBindings = loadTemplate('templateWithBindings', COUNT);
|
||||
var templateWithBindings = loadTemplate('templateWithBindings', count);
|
||||
var templateNoBindings = loadTemplate('templateWithBindings', count);
|
||||
|
||||
final injector = applicationFactory().addModule(m).run();
|
||||
final compiler = injector.get(Compiler);
|
||||
final directiveMap = injector.get(DirectiveMap);
|
||||
|
||||
compileWithBindings(_) {
|
||||
compileWithBindings() {
|
||||
final cloned = templateWithBindings.clone(true);
|
||||
compiler([cloned], directiveMap);
|
||||
}
|
||||
|
||||
compileNoBindings(_) {
|
||||
compileNoBindings() {
|
||||
final cloned = templateNoBindings.clone(true);
|
||||
compiler([cloned], directiveMap);
|
||||
}
|
||||
|
||||
document.querySelector('#compileWithBindings').addEventListener('click', compileWithBindings);
|
||||
document.querySelector('#compileNoBindings').addEventListener('click', compileNoBindings);
|
||||
bindAction('#compileWithBindings', compileWithBindings);
|
||||
bindAction('#compileNoBindings', compileNoBindings);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// compiler benchmark in AngularJS 1.x
|
||||
var COUNT = 30;
|
||||
import {getIntParameter, bindAction} from 'e2e_test_lib/benchmark_util';
|
||||
|
||||
export function main() {
|
||||
var ngEl = document.createElement('div');
|
||||
@ -74,19 +74,20 @@ angular.module('app', [])
|
||||
};
|
||||
}])
|
||||
.run(['$compile', function($compile) {
|
||||
var templateNoBindings = loadTemplate('templateNoBindings', COUNT);
|
||||
var templateWithBindings = loadTemplate('templateWithBindings', COUNT);
|
||||
var count = getIntParameter('elements');
|
||||
var templateNoBindings = loadTemplate('templateNoBindings', count);
|
||||
var templateWithBindings = loadTemplate('templateWithBindings', count);
|
||||
|
||||
document.querySelector('#compileWithBindings').addEventListener('click', compileWithBindings, false);
|
||||
document.querySelector('#compileNoBindings').addEventListener('click', compileNoBindings, false);
|
||||
bindAction('#compileWithBindings', compileWithBindings);
|
||||
bindAction('#compileNoBindings', compileNoBindings);
|
||||
|
||||
function compileNoBindings(_) {
|
||||
function compileNoBindings() {
|
||||
// Need to clone every time as the compiler might modify the template!
|
||||
var cloned = templateNoBindings.cloneNode(true);
|
||||
$compile(cloned);
|
||||
}
|
||||
|
||||
function compileWithBindings(_) {
|
||||
function compileWithBindings() {
|
||||
// Need to clone every time as the compiler might modify the template!
|
||||
var cloned = templateWithBindings.cloneNode(true);
|
||||
$compile(cloned);
|
||||
|
@ -2,8 +2,19 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<button id="compileWithBindings">Compile template with bindings</button>
|
||||
<button id="compileNoBindings">Compile template without bindings</button>
|
||||
<h2>Params</h2>
|
||||
<form>
|
||||
Elements:
|
||||
<input type="number" name="elements" placeholder="elements" value="150">
|
||||
<br>
|
||||
<button>Apply</button>
|
||||
</form>
|
||||
|
||||
<h2>Actions</h2>
|
||||
<p>
|
||||
<button id="compileWithBindings">CompileWithBindings</button>
|
||||
<button id="compileNoBindings">CompileNoBindings</button>
|
||||
</p>
|
||||
|
||||
<template id="templateNoBindings">
|
||||
<div class="class0 class1 class2 class3 class4 " nodir0="" attr0="value0" nodir1="" attr1="value1" nodir2="" attr2="value2" nodir3="" attr3="value3" nodir4="" attr4="value4">
|
||||
|
@ -4,8 +4,7 @@ library tree_benchmark_ng10;
|
||||
import 'package:angular/angular.dart';
|
||||
import 'package:angular/application_factory.dart';
|
||||
import 'dart:html';
|
||||
|
||||
var MAX_DEPTH = 9;
|
||||
import 'package:e2e_test_lib/benchmark_util.dart';
|
||||
|
||||
setup() {
|
||||
|
||||
@ -20,29 +19,31 @@ setup() {
|
||||
}
|
||||
|
||||
main() {
|
||||
var maxDepth = getIntParameter('depth');
|
||||
|
||||
final injector = setup();
|
||||
final zone = injector.get(VmTurnZone);
|
||||
final rootScope = injector.get(Scope);
|
||||
var count = 0;
|
||||
|
||||
destroyDom(_) {
|
||||
destroyDom() {
|
||||
zone.run(() {
|
||||
rootScope.context['initData'] = new TreeNode('');
|
||||
});
|
||||
}
|
||||
|
||||
createDom(_) {
|
||||
createDom() {
|
||||
zone.run(() {
|
||||
var values = count++ % 2 == 0 ?
|
||||
['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*'] :
|
||||
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', '-'];
|
||||
|
||||
rootScope.context['initData'] = buildTree(MAX_DEPTH, values, 0);
|
||||
rootScope.context['initData'] = buildTree(maxDepth, values, 0);
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelector('#destroyDom').addEventListener('click', destroyDom);
|
||||
document.querySelector('#createDom').addEventListener('click', createDom);
|
||||
bindAction('#destroyDom', destroyDom);
|
||||
bindAction('#createDom', createDom);
|
||||
}
|
||||
|
||||
@Component(
|
||||
|
@ -1,5 +1,5 @@
|
||||
// tree benchmark in AngularJS 1.x
|
||||
var MAX_DEPTH = 9;
|
||||
import {getIntParameter, bindAction} from 'e2e_test_lib/benchmark_util';
|
||||
|
||||
export function main() {
|
||||
angular.bootstrap(document.body, ['app']);
|
||||
@ -57,24 +57,24 @@ angular.module('app', [])
|
||||
}])
|
||||
.run(['$rootScope', function($rootScope) {
|
||||
var count = 0;
|
||||
var maxDepth = getIntParameter('depth');
|
||||
|
||||
document.querySelector('#destroyDom').addEventListener('click', destroyDom, false);
|
||||
document.querySelector('#createDom').addEventListener('click', createDom, false);
|
||||
bindAction('#destroyDom', destroyDom);
|
||||
bindAction('#createDom', createDom);
|
||||
|
||||
function destroyDom(_) {
|
||||
function destroyDom() {
|
||||
$rootScope.$apply(function() {
|
||||
$rootScope.initData = new TreeNode('', null, null);
|
||||
});
|
||||
}
|
||||
|
||||
function createDom(_) {
|
||||
var maxDepth = MAX_DEPTH;
|
||||
function createDom() {
|
||||
var values = count++ % 2 == 0 ?
|
||||
['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*'] :
|
||||
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', '-'];
|
||||
|
||||
$rootScope.$apply(function() {
|
||||
$rootScope.initData = buildTree(MAX_DEPTH, values, 0);
|
||||
$rootScope.initData = buildTree(maxDepth, values, 0);
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
@ -2,6 +2,14 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<h2>Params</h2>
|
||||
<form>
|
||||
Depth:
|
||||
<input type="number" name="depth" placeholder="depth" value="9">
|
||||
<br>
|
||||
<button>Apply</button>
|
||||
</form>
|
||||
|
||||
<h2>AngularJS/Dart 1.x tree benchmark</h2>
|
||||
<p>
|
||||
<button id="destroyDom">destroyDom</button>
|
||||
|
Reference in New Issue
Block a user