Skip to content

Commit f82ab4c

Browse files
scheglovCommit Queue
authored and
Commit Queue
committed
Completion. Speed. Use identical() in isSubtypeOf().
Before: [1710693275292][time: 774 ms][mean: 750.0][stdDev: 23.531][min: 693.0][max: 814.0] After: [1710696094848][time: 659 ms][mean: 607.0][stdDev: 28.995][min: 548.0][max: 736.0] So, about 20% faster. When ```dart import 'package:flutter/widgets.dart'; Widget x = ^; ``` Change-Id: I30682382748e3e03e9fe28da6cd854280c926b32 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358100 Reviewed-by: Keerti Parthasarathy <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 252abba commit f82ab4c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/analyzer/lib/src/dart/element/subtype.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ class SubtypeHelper {
447447

448448
var subElement = subType.element;
449449
var superElement = superType.element;
450-
if (subElement == superElement) {
450+
if (identical(subElement, superElement)) {
451451
return _interfaceArguments(superElement, subType, superType);
452452
}
453453

@@ -457,7 +457,7 @@ class SubtypeHelper {
457457
}
458458

459459
for (var interface in subElement.allSupertypes) {
460-
if (interface.element == superElement) {
460+
if (identical(interface.element, superElement)) {
461461
var substitution = Substitution.fromInterfaceType(subType);
462462
var substitutedInterface =
463463
substitution.substituteType(interface) as InterfaceType;

0 commit comments

Comments
 (0)