本文整理汇总了TypeScript中benchmark.Suite.run方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Suite.run方法的具体用法?TypeScript Suite.run怎么用?TypeScript Suite.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类benchmark.Suite
的用法示例。
在下文中一共展示了Suite.run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
suite.add(`local runtime-html BasicConfiguration`, function() {
local.kernel.DI.createContainer().register(local.runtimeHtml.BasicConfiguration);
});
suite.add(`local jit-html BasicConfiguration`, function() {
local.kernel.DI.createContainer().register(local.jitHtml.BasicConfiguration);
});
suite.add(` dev runtime-html BasicConfiguration`, function() {
dev.kernel.DI.createContainer().register(dev.runtimeHtml.HTMLRuntimeConfiguration);
});
suite.add(` dev jit-html BasicConfiguration`, function() {
dev.kernel.DI.createContainer().register(dev.jitHtml.HTMLJitConfiguration);
});
suite.run();
},
['resolve']() {
const count = parseInt(rest[0], 10);
class LocalSingleton {
static register(container) {
return local.kernel.Registration.singleton(LocalSingleton, this).register(container);
}
}
class LocalTransient {
static register(container) {
return local.kernel.Registration.transient(LocalTransient, this).register(container);
}
}
class DevSingleton {
static register(container) {
示例2: PrioritizedHandlers
const eventTypes = global.require('../event-system/eventTypes').default;
const eventPriorities = global.require('../event-system/eventTypes').eventPriorities;
const Handler = global.require('../event-system/Handler').default;
const prioritizedHandlers = new PrioritizedHandlers();
}
})
// add listeners
.on('cycle', function (event) {
console.log(String(event.target), event.target.error || '');
})
.on('complete', function () {
// console.dir(this)
console.log('Fastest is ' + this.filter('fastest').map('name'));
});
suite.run({ 'async': true });
//
// .add('SubscribedHandlers#remove 1 of 11', function () {
// subscribedHandlers.add(subscription);
// subscribedHandlers.remove(subscription);
// }, {
// setup: function () {
// const SubscribedHandlers = global.require('../SubscribedHandlers').default;
// const subscribedHandlers = new SubscribedHandlers();
// let j = 0;
//
// function addEvents() {
// for (var i = 0; i < 5; i++)
// subscribedHandlers.add({ eventName: 'event' + i, component: { id: 0 }, priority: j++ });
示例3:
const array = new ObservableArray<number>([]);
const even = array.map(x => x % 2 === 0);
for (let i = 0; i < 100; i++) {
array.push(i);
}
})
.add("ComputedArray#some", () => {
const array = new ObservableArray<number>([]);
const even = array.some(x => x % 2 === 0);
for (let i = 0; i < 100; i++) {
array.push(i);
}
})
.add("ComputedArray#every", () => {
const array = new ObservableArray<number>([]);
const even = array.every(x => x % 2 === 0);
for (let i = 0; i < 100; i++) {
array.push(i);
}
})
.add("ComputedArray#reduce", () => {
const array = new ObservableArray<number>([]);
const max = array.reduce((x, y) => x > y ? x : y, 0);
for (let i = 0; i < 100; i++) {
array.push(i);
}
});
suite.run({ async: true });
export default suite;