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

Unified Diff: pkg/analyzer/lib/dart/ast/ast.dart

Issue 1955373003: Convert some for-in loops for performance (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 | pkg/analyzer/lib/dart/ast/token.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/dart/ast/ast.dart
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 89be5a54be3cf9f24e66a80fccad4afec9fa0d83..c33b26dd9e5ffa377100869227d6a136e646732d 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -4579,16 +4579,22 @@ abstract class ImportDirective extends NamespaceDirective {
NodeList<Combinator> combinators1 = import1.combinators;
List<String> allHides1 = new List<String>();
List<String> allShows1 = new List<String>();
- for (Combinator combinator in combinators1) {
+ int length1 = combinators1.length;
+ for (int i = 0; i < length1; i++) {
+ Combinator combinator = combinators1[i];
if (combinator is HideCombinator) {
NodeList<SimpleIdentifier> hides = combinator.hiddenNames;
- for (SimpleIdentifier simpleIdentifier in hides) {
+ int hideLength = hides.length;
+ for (int j = 0; j < hideLength; j++) {
+ SimpleIdentifier simpleIdentifier = hides[j];
allHides1.add(simpleIdentifier.name);
}
} else {
NodeList<SimpleIdentifier> shows =
(combinator as ShowCombinator).shownNames;
- for (SimpleIdentifier simpleIdentifier in shows) {
+ int showLength = shows.length;
+ for (int j = 0; j < showLength; j++) {
+ SimpleIdentifier simpleIdentifier = shows[j];
allShows1.add(simpleIdentifier.name);
}
}
@@ -4596,16 +4602,22 @@ abstract class ImportDirective extends NamespaceDirective {
NodeList<Combinator> combinators2 = import2.combinators;
List<String> allHides2 = new List<String>();
List<String> allShows2 = new List<String>();
- for (Combinator combinator in combinators2) {
+ int length2 = combinators2.length;
+ for (int i = 0; i < length2; i++) {
+ Combinator combinator = combinators2[i];
if (combinator is HideCombinator) {
NodeList<SimpleIdentifier> hides = combinator.hiddenNames;
- for (SimpleIdentifier simpleIdentifier in hides) {
+ int hideLength = hides.length;
+ for (int j = 0; j < hideLength; j++) {
+ SimpleIdentifier simpleIdentifier = hides[j];
allHides2.add(simpleIdentifier.name);
}
} else {
NodeList<SimpleIdentifier> shows =
(combinator as ShowCombinator).shownNames;
- for (SimpleIdentifier simpleIdentifier in shows) {
+ int showLength = shows.length;
+ for (int j = 0; j < showLength; j++) {
+ SimpleIdentifier simpleIdentifier = shows[j];
allShows2.add(simpleIdentifier.name);
}
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/dart/ast/token.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698