refactor (benchmarks/): Ts'ifying benchmarks/

Translating AtScript in benchmarks/ to TypeScript.
This commit is contained in:
Ian Riley
2015-05-29 21:40:15 -07:00
committed by Tobias Bosch
parent 0b43e3cf32
commit 2b60d1bae1
48 changed files with 1590 additions and 1715 deletions

View File

@ -22,47 +22,35 @@ export function main() {
var proto = ProtoElementInjector.create(null, 0, bindings, false, 0);
var elementInjector = proto.instantiate(null);
function instantiate () {
function instantiate() {
for (var i = 0; i < iterations; ++i) {
var ei = proto.instantiate(null);
ei.hydrate(appInjector, null, null);
}
}
function hydrate () {
function hydrate() {
for (var i = 0; i < iterations; ++i) {
elementInjector.dehydrate();
elementInjector.hydrate(appInjector, null, null);
}
}
bindAction(
'#instantiate',
() => microBenchmark('instantiateAvg', iterations, instantiate)
);
bindAction(
'#hydrate',
() => microBenchmark('instantiateAvg', iterations, hydrate)
);
bindAction('#instantiate', () => microBenchmark('instantiateAvg', iterations, instantiate));
bindAction('#hydrate', () => microBenchmark('instantiateAvg', iterations, hydrate));
}
@Injectable()
class A {
constructor() {
count++;
}
constructor() { count++; }
}
@Injectable()
class B {
constructor() {
count++;
}
constructor() { count++; }
}
@Injectable()
class C {
constructor(a:A, b:B) {
count++;
}
constructor(a: A, b: B) { count++; }
}