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

Unified Diff: tools/testing/dart/status_file_parser.dart

Issue 258523006: Reduce memory usage of test.dart: canonicalize Set<Expectation> (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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: tools/testing/dart/status_file_parser.dart
diff --git a/tools/testing/dart/status_file_parser.dart b/tools/testing/dart/status_file_parser.dart
index a7d3080f943dd48c29e12e4d7933245f8dd6c546..f728636386c61661f05607d66cd5b492f779491a 100644
--- a/tools/testing/dart/status_file_parser.dart
+++ b/tools/testing/dart/status_file_parser.dart
@@ -253,6 +253,11 @@ class TestRule {
class TestExpectations {
+ // Only create one copy of each Set<Expectation>.
+ // We just use .toString as a key, so we may make a few
+ // sets that only differ in their toString element order.
+ static Map _cachedSets = new Map();
+
Map _map;
bool _preprocessed = false;
Map _regExpCache;
@@ -312,7 +317,7 @@ class TestExpectations {
if (result.isEmpty) {
result.add(Expectation.PASS);
}
- return result;
+ return _cachedSets.putIfAbsent(result.toString(), () => result);
}
// Preprocess the expectations for matching against
« 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