angular-docs-cn/modules/benchmarks/e2e_test/element_injector_perf.es6
Tobias Bosch 77aa3ed61b feat(benchpress): show more metrics and make the run mode configurable
Shows the metrics:
script, render, gcAmount, gcAmountInScript, gcTime

Run modes:
- detect: auto detect whether to force gc
- forceGc: forces a gc before every run and ignores no runs
- noGcInScript: ignore runs that have gc while a script was executing
- plain: does not force gc nor ignore runs

Closes #368
2015-01-07 16:37:52 -08:00

40 lines
1.0 KiB
JavaScript

"use strict";
var benchpress = require('../../../tools/benchpress/index.js');
describe('ng2 element injector benchmark', function () {
var URL = 'benchmarks/web/element_injector/element_injector_benchmark.html';
afterEach(benchpress.verifyNoBrowserErrors);
it('should log the stats for instantiate', function() {
browser.get(URL);
runClickBenchmark({
buttons: ['#instantiate'],
logId: 'ng2.elementInjector.instantiate'
});
});
it('should log the stats for instantiateDirectives', function() {
browser.get(URL);
runClickBenchmark({
buttons: ['#instantiateDirectives'],
logId: 'ng2.elementInjector.instantiateDirectives'
});
});
});
function runClickBenchmark(config) {
var buttons = config.buttons.map(function(selector) {
return $(selector);
});
var params = Object.create(browser.params.benchmark);
params.logId = browser.params.lang+'.'+config.logId;
benchpress.runBenchmark(params, function() {
buttons.forEach(function(button) {
button.click();
});
});
}