feat(compiler): add benchmarks

- compileEmptyTemplate
- compile25ElementsNoBindings
- compile25ElementsWithBindings

For the results see the PR #197.

Closes #197
This commit is contained in:
Tobias Bosch
2014-11-14 14:03:03 -08:00
parent aa9eeb80e7
commit b07ea6b90e
6 changed files with 235 additions and 15 deletions

View File

@ -39,14 +39,13 @@ export class Compiler {
compile(component:Type, templateRoot:Element = null):Promise<ProtoView> {
// TODO load all components transitively from the cache first
var cache = null;
return PromiseWrapper.resolve(this._compileAllCached(
this._reflector.annotatedType(component),
cache,
templateRoot)
return PromiseWrapper.resolve(this.compileWithCache(
cache, this._reflector.annotatedType(component), templateRoot)
);
}
_compileAllCached(component:AnnotatedType, cache, templateRoot:Element = null):ProtoView {
// public so that we can compile in sync in performance tests.
compileWithCache(cache, component:AnnotatedType, templateRoot:Element = null):ProtoView {
if (isBlank(templateRoot)) {
// TODO: read out the cache if templateRoot = null. Could contain:
// - templateRoot string
@ -62,7 +61,7 @@ export class Compiler {
for (var i=0; i<compileElements.length; i++) {
var ce = compileElements[i];
if (isPresent(ce.componentDirective)) {
ce.inheritedElementBinder.nestedProtoView = this._compileAllCached(ce.componentDirective, cache, null);
ce.inheritedElementBinder.nestedProtoView = this.compileWithCache(cache, ce.componentDirective, null);
}
}

View File

@ -1,4 +1,4 @@
library facade.di.reflector;
library facade.compiler.reflector;
import 'dart:mirrors';
import '../annotations/directive.dart';