Skip to content

Commit

Permalink
perf(AngularTransformerGroup): creates only one Resolvers object
Browse files Browse the repository at this point in the history
This change reduces the consumed memory during a build by about 50%. It uses the same Resolvers object to initialize all ResolverTransformer of the TransformerGroup.

Issue dart-archive#1683
  • Loading branch information
heisaf committed Mar 5, 2015
1 parent f9406a4 commit 0965ac6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ Map<String, String> _readStringMapValue(Map args, String name) {
return value;
}

Transformer _staticGenerator(TransformOptions options) {
var resolvers = new Resolvers(options.sdkDirectory);
Transformer _staticGenerator(TransformOptions options, Resolvers resolvers) {
return new _SerialTransformer([
new TypeRelativeUriGenerator(options, resolvers),
new ExpressionGenerator(options, resolvers),
Expand All @@ -148,13 +147,15 @@ Transformer _staticGenerator(TransformOptions options) {
]);
}

List<List<Transformer>> _createPhases(TransformOptions options) =>
[
[ new ObservableTransformer() ],
[ new HtmlDartReferencesGenerator(options) ],
[ new di.InjectorGenerator(options.diOptions, new Resolvers(options.sdkDirectory)) ],
[ _staticGenerator(options) ]
];
List<List<Transformer>> _createPhases(TransformOptions options) {
var resolvers = new Resolvers(options.sdkDirectory);
return [
[ new ObservableTransformer() ],
[ new HtmlDartReferencesGenerator(options) ],
[ new di.InjectorGenerator(options.diOptions, resolvers ) ],
[ _staticGenerator(options, resolvers) ]
];
}

/// Helper which runs a group of transformers serially and ensures that
/// transformers with shared data are always applied in a specific order.
Expand Down

0 comments on commit 0965ac6

Please sign in to comment.