Index: pkg/analyzer/lib/src/dart/analysis/driver.dart |
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart |
index 045d9c60f578ad4ba21cf7d3669696a66016a7db..8439bcc033aaf947c3e599f035cea398a5a7072b 100644 |
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart |
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart |
@@ -126,6 +126,12 @@ class AnalysisDriver { |
final _filesToAnalyze = new LinkedHashSet<String>(); |
/** |
+ * The mapping of [Uri]s to the mapping of textual URIs to the [Source] |
+ * that correspond in the current [_sourceFactory]. |
Paul Berry
2016/10/24 12:00:48
I'm having trouble parsing this comment. Consider
scheglov
2016/10/24 17:51:34
Done.
Thank you.
|
+ */ |
+ final _uriResolutionCache = <Uri, Map<String, Source>>{}; |
+ |
+ /** |
* The current file state. |
* |
* It maps file paths to the MD5 hash of the file content. |
@@ -807,7 +813,9 @@ class _File { |
* Return the [_File] for the [uri] referenced in this file. |
*/ |
_File resolveUri(String uri) { |
- Source uriSource = driver._sourceFactory.resolveUri(source, uri); |
+ Source uriSource = driver._uriResolutionCache |
+ .putIfAbsent(this.uri, () => <String, Source>{}) |
+ .putIfAbsent(uri, () => driver._sourceFactory.resolveUri(source, uri)); |
Paul Berry
2016/10/24 12:00:48
This seems like a rather minor optimization compar
scheglov
2016/10/24 17:51:34
I agree about unnecessary optimizations.
Adding TO
|
return new _File(driver, uriSource); |
} |