Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: pkg/compiler/lib/src/deferred_load.dart

Issue 3000003002: call _getImports only once: on a large app this was about 5s extra. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/deferred_load.dart
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index fe77fd4bcad0d127e722fd624772f0631cb09b2a..722812b266726acde422b08401661b2593441d56 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -261,10 +261,9 @@ class DeferredLoadTask extends CompilerTask {
_constantToOutputUnit[constant] = _getCanonicalUnit(outputUnit);
}
- /// Answers whether [element] is explicitly deferred when referred to from
- /// [library].
- bool _isExplicitlyDeferred(Element element, LibraryElement library) {
- Iterable<ImportElement> imports = _getImports(element, library);
+ /// Given [imports] that refer to an element from a library, determine whether
+ /// the element is explicitly deferred.
+ static bool _isExplicitlyDeferred(Iterable<ImportElement> imports) {
// If the element is not imported explicitly, it is implicitly imported
// not deferred.
if (imports.isEmpty) return false;
@@ -558,8 +557,9 @@ class DeferredLoadTask extends CompilerTask {
}
for (Element dependency in dependentElements) {
- if (_isExplicitlyDeferred(dependency, library)) {
- for (ImportElement deferredImport in _getImports(dependency, library)) {
+ Iterable<ImportElement> imports = _getImports(dependency, library);
+ if (_isExplicitlyDeferred(imports)) {
+ for (ImportElement deferredImport in imports) {
_mapDependencies(
element: dependency,
import: new _DeclaredDeferredImport(deferredImport));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698