本文整理汇总了TypeScript中angular2/src/testing/benchmark_util.getIntParameter函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getIntParameter函数的具体用法?TypeScript getIntParameter怎么用?TypeScript getIntParameter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getIntParameter函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: main
export function main() {
BrowserDomAdapter.makeCurrent();
var iterations = getIntParameter('iterations');
reflector.reflectionCapabilities = new ReflectionCapabilities();
var providers = [
DirectiveProvider.createFromType(A, null),
DirectiveProvider.createFromType(B, null),
DirectiveProvider.createFromType(C, null)
];
var proto = ProtoElementInjector.create(null, 0, providers, false, 0, null);
var elementInjector = proto.instantiate(null);
function instantiate() {
for (var i = 0; i < iterations; ++i) {
var ei = proto.instantiate(null);
ei.hydrate(null, null, null);
}
}
function hydrate() {
for (var i = 0; i < iterations; ++i) {
elementInjector.dehydrate();
elementInjector.hydrate(null, null, null);
}
}
bindAction('#instantiate', () => microBenchmark('instantiateAvg', iterations, instantiate));
bindAction('#hydrate', () => microBenchmark('instantiateAvg', iterations, hydrate));
}
示例2: main
export function main() {
var size = getIntParameter('size');
testList = ListWrapper.createFixedSize(size);
bootstrap(AppComponent)
.then((ref) => {
var injector = ref.injector;
var app: AppComponent = ref.instance;
var appRef = injector.get(ApplicationRef);
bindAction('#reset', function() {
app.reset();
appRef.tick();
});
// Baseline (plain components)
bindAction('#createPlainComponents', function() {
app.createPlainComponents();
appRef.tick();
});
// Components with decorators
bindAction('#createComponentsWithDirectives', function() {
app.createComponentsWithDirectives();
appRef.tick();
});
// Components with decorators
bindAction('#createDynamicComponents', function() {
app.createDynamicComponents();
appRef.tick();
});
});
}
示例3: constructor
constructor() {
var appSize = getIntParameter('appSize');
this.iterationCount = getIntParameter('iterationCount');
this.scrollIncrement = getIntParameter('scrollIncrement');
appSize = appSize > 1 ? appSize - 1 : 0; // draw at least one table
this.scrollAreas = [];
for (var i = 0; i < appSize; i++) {
this.scrollAreas.push(i);
}
bindAction('#run-btn', () => { this.runBenchmark(); });
bindAction('#reset-btn', () => {
this._getScrollDiv().scrollTop = 0;
var existingMarker = this._locateFinishedMarker();
if (isPresent(existingMarker)) {
DOM.removeChild(document.body, existingMarker);
}
});
}
示例4: main
export function main() {
BrowserDomAdapter.makeCurrent();
var count = getIntParameter('selectors');
var fixedMatcher;
var fixedSelectorStrings = [];
var fixedSelectors = [];
for (var i = 0; i < count; i++) {
fixedSelectorStrings.push(randomSelector());
}
for (var i = 0; i < count; i++) {
fixedSelectors.push(CssSelector.parse(fixedSelectorStrings[i]));
}
fixedMatcher = new SelectorMatcher();
for (var i = 0; i < count; i++) {
fixedMatcher.addSelectables(fixedSelectors[i], i);
}
function parse() {
var result = [];
for (var i = 0; i < count; i++) {
result.push(CssSelector.parse(fixedSelectorStrings[i]));
}
return result;
}
function addSelectable() {
var matcher = new SelectorMatcher();
for (var i = 0; i < count; i++) {
matcher.addSelectables(fixedSelectors[i], i);
}
return matcher;
}
function match() {
var matchCount = 0;
for (var i = 0; i < count; i++) {
fixedMatcher.match(fixedSelectors[i][0], (selector, selected) => { matchCount += selected; });
}
return matchCount;
}
bindAction('#parse', parse);
bindAction('#addSelectable', addSelectable);
bindAction('#match', match);
}
示例5: function
function($rootScope) {
var count = 0;
var maxDepth = getIntParameter('depth');
bindAction('#destroyDom', destroyDom);
bindAction('#createDom', createDom);
function destroyDom() {
$rootScope.$apply(function() { $rootScope.initData = new TreeNode('', null, null); });
}
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(maxDepth, values, 0); });
}
}
示例6: main
export function main() {
var count = 0;
var maxDepth = getIntParameter('depth');
bindAction('#destroyDom', destroyDom);
bindAction('#createDom', createDom);
var empty = new TreeNode(0, null, null);
var rootComponent = React.render(React.createElement(TreeComponent, {treeNode: empty}, ""),
document.getElementById('rootTree'));
function destroyDom() { rootComponent.setProps({treeNode: empty}); }
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', '-'];
rootComponent.setProps({treeNode: buildTree(maxDepth, values, 0)});
}
}
示例7: main
export function main() {
BrowserDomAdapter.makeCurrent();
var iterations = getIntParameter('iterations');
// This benchmark does not use bootstrap and needs to create a reflector
setupReflector();
var bindings = [A, B, C, D, E];
var injector = Injector.resolveAndCreate(bindings);
var D_KEY = Key.get(D);
var E_KEY = Key.get(E);
var childInjector = injector.resolveAndCreateChild([])
.resolveAndCreateChild([])
.resolveAndCreateChild([])
.resolveAndCreateChild([])
.resolveAndCreateChild([]);
var variousProviders = [A, provide(B, {useClass: C}), [D, [E]], provide(F, {useValue: 6})];
var variousProvidersResolved = Injector.resolve(variousProviders);
function getByToken() {
for (var i = 0; i < iterations; ++i) {
injector.get(D);
injector.get(E);
}
}
function getByKey() {
for (var i = 0; i < iterations; ++i) {
injector.get(D_KEY);
injector.get(E_KEY);
}
}
function getChild() {
for (var i = 0; i < iterations; ++i) {
childInjector.get(D);
childInjector.get(E);
}
}
function instantiate() {
for (var i = 0; i < iterations; ++i) {
var child = injector.resolveAndCreateChild([E]);
child.get(E);
}
}
/**
* Creates an injector with a variety of provider types.
*/
function createVariety() {
for (var i = 0; i < iterations; ++i) {
Injector.resolveAndCreate(variousProviders);
}
}
/**
* Same as [createVariety] but resolves providers ahead of time.
*/
function createVarietyResolved() {
for (var i = 0; i < iterations; ++i) {
Injector.fromResolvedProviders(variousProvidersResolved);
}
}
bindAction('#getByToken', () => microBenchmark('injectAvg', iterations, getByToken));
bindAction('#getByKey', () => microBenchmark('injectAvg', iterations, getByKey));
bindAction('#getChild', () => microBenchmark('injectAvg', iterations, getChild));
bindAction('#instantiate', () => microBenchmark('injectAvg', iterations, instantiate));
bindAction('#createVariety', () => microBenchmark('injectAvg', iterations, createVariety));
bindAction('#createVarietyResolved',
() => microBenchmark('injectAvg', iterations, createVarietyResolved));
}
示例8: getIntParameter
import {getIntParameter, getStringParameter, bindAction} from 'angular2/src/testing/benchmark_util';
declare var angular: any;
var totalRows = getIntParameter('rows');
var totalColumns = getIntParameter('columns');
var benchmarkType = getStringParameter('benchmarkType');
export function main() {
angular.bootstrap(document.querySelector('largetable'), ['app']);
}
angular.module('app', [])
.config(function($compileProvider) {
if ($compileProvider.debugInfoEnabled) {
$compileProvider.debugInfoEnabled(false);
}
})
.filter('noop', function() { return function(input) { return input; }; })
.directive('largetable',
function() {
return {
restrict: 'E',
templateUrl: 'largetable-js-template.html',
controller: 'DataController'
};
})
.controller('DataController',
function($scope) {
bindAction('#destroyDom', destroyDom);
bindAction('#createDom', createDom);