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

Unified Diff: pkg/compiler/lib/src/types/flat_type_mask.dart

Issue 1611783003: dart2js: improve performance of TypeMask.intersection (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
Index: pkg/compiler/lib/src/types/flat_type_mask.dart
diff --git a/pkg/compiler/lib/src/types/flat_type_mask.dart b/pkg/compiler/lib/src/types/flat_type_mask.dart
index 0f3aa13bca90da8ee0acfc5c6584e0f56ae4af41..270271d1ae88de617b4665984313cbb0c8a5958c 100644
--- a/pkg/compiler/lib/src/types/flat_type_mask.dart
+++ b/pkg/compiler/lib/src/types/flat_type_mask.dart
@@ -732,16 +732,7 @@ class FlatTypeMask implements TypeMask {
if (xSubset == null) return null;
Iterable<ClassElement> ySubset = containedSubset(y, classWorld);
if (ySubset == null) return null;
- Iterable<ClassElement> smallSet, largeSet;
- if (xSubset.length <= ySubset.length) {
Siggi Cherem (dart-lang) 2016/01/21 01:07:12 this was the most important change: this was worse
- smallSet = xSubset;
- largeSet = ySubset;
- } else {
- smallSet = ySubset;
- largeSet = xSubset;
- }
- var result = smallSet.where((ClassElement each) => largeSet.contains(each));
- return result.toSet();
+ return xSubset.toSet().intersection(ySubset.toSet());
}
static Iterable<ClassElement> containedSubset(FlatTypeMask x,
« no previous file with comments | « no previous file | pkg/compiler/lib/src/types/union_type_mask.dart » ('j') | pkg/compiler/lib/src/types/union_type_mask.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698