Make possible to don't track cache dependencies.

If 'trackCacheDependencies' is set to 'false', this makes DDC
compilation of Angular2 project about 10% faster.

Unfortunately I was not able to avoid creating ResultDescriptor(s) and
adding them into WorkItem.inputTargetedResults altogether. It is used
in AnalysisTask._findCyclicPath() to create InfiniteTaskLoopException
with additional information.

R=brianwilkerson@google.com, paulberry@google.com
BUG=

Review URL: https://codereview.chromium.org/2054453002 .
This commit is contained in:
Konstantin Shcheglov 2016-06-09 08:23:15 -07:00
parent f183ec3a45
commit d7ec8ca711
4 changed files with 20 additions and 1 deletions

View file

@ -298,6 +298,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
this._options.lint = options.lint;
this._options.preserveComments = options.preserveComments;
this._options.strongMode = options.strongMode;
this._options.trackCacheDependencies = options.trackCacheDependencies;
if (options is AnalysisOptionsImpl) {
this._options.strongModeHints = options.strongModeHints;
}

View file

@ -1143,6 +1143,14 @@ abstract class AnalysisOptions {
*/
bool get strongMode;
/**
* Return `true` if dependencies between computed results should be tracked
* by analysis cache. This option should only be set to `false` if analysis
* is performed in such a way that none of the inputs is ever changed
* during the life time of the context.
*/
bool get trackCacheDependencies;
/**
* Return an integer encoding of the values of the options that need to be the
* same across all of the contexts associated with partitions that are to be
@ -1283,6 +1291,9 @@ class AnalysisOptionsImpl implements AnalysisOptions {
// TODO(leafp): replace this with something more general
bool strongModeHints = false;
@override
bool trackCacheDependencies = true;
/**
* Initialize a newly created set of analysis options to have their default
* values.
@ -1315,6 +1326,7 @@ class AnalysisOptionsImpl implements AnalysisOptions {
if (options is AnalysisOptionsImpl) {
strongModeHints = options.strongModeHints;
}
trackCacheDependencies = options.trackCacheDependencies;
}
bool get analyzeFunctionBodies {

View file

@ -278,7 +278,10 @@ class AnalysisDriver {
AnalysisTarget target = task.target;
CacheEntry entry = context.getCacheEntry(target);
if (task.caughtException == null) {
List<TargetedResult> dependedOn = item.inputTargetedResults.toList();
List<TargetedResult> dependedOn =
context.analysisOptions.trackCacheDependencies
? item.inputTargetedResults.toList()
: const <TargetedResult>[];
Map<ResultDescriptor, dynamic> outputs = task.outputs;
List<ResultDescriptor> results = task.descriptor.results;
int resultLength = results.length;

View file

@ -818,6 +818,9 @@ class _InternalAnalysisContextMock extends TypedMock
implements InternalAnalysisContext {
AnalysisCache analysisCache;
@override
final AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl();
@override
List<AnalysisTarget> explicitTargets = <AnalysisTarget>[];