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:
Tobias Bosch
2015-01-09 18:00:04 -08:00
parent af02f2beb1
commit d02c0accbb
53 changed files with 981 additions and 599 deletions

View File

@ -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(

View File

@ -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);
});
}
}]);

View File

@ -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>