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

Unified Diff: pkg/compiler/lib/src/inferrer/node_tracer.dart

Issue 2602863002: Speed up _wouldBeTooManyUsers. (Closed)
Patch Set: Remove dead code. Created 4 years 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/inferrer/node_tracer.dart
diff --git a/pkg/compiler/lib/src/inferrer/node_tracer.dart b/pkg/compiler/lib/src/inferrer/node_tracer.dart
index 058d36ddc5cc33664930350ede385f1f4f459035..72c696544da8b226e23a4ab927b424aa5731a951 100644
--- a/pkg/compiler/lib/src/inferrer/node_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/node_tracer.dart
@@ -113,10 +113,14 @@ abstract class TracerVisitor<T extends TypeInformation>
bool _wouldBeTooManyUsers(Set users) {
int seenSoFar = analyzedElements.length;
if (seenSoFar + users.length <= MAX_ANALYSIS_COUNT) return false;
- int actualWork = users
- .where((TypeInformation user) => !analyzedElements.contains(user.owner))
- .length;
- return seenSoFar + actualWork > MAX_ANALYSIS_COUNT;
+ int actualWork = 0;
+ for (TypeInformation user in users) {
+ if (!analyzedElements.contains(user.owner)) {
+ actualWork++;
+ if (actualWork > MAX_ANALYSIS_COUNT - seenSoFar) return true;
+ }
+ }
+ return false;
}
void analyze() {
« 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