mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:45:06 +00:00
86fde60e4d
This CL optimizes Type.hashCode similarly to String.hashCode, by introducing intrinsic version of hashCode calculation which uses hashcode stored in Type instance. This is important for Flutter's .of pattern, which heavily uses Maps with Type keys. Results on Flutter stocks/build_bench.dart microbenchmark: Before: 4906 µs After: 4751 µs (minimum of 5 runs, using tip of Flutter and Flutter engine) Issue: https://github.com/dart-lang/sdk/issues/31011 Issue: https://github.com/flutter/flutter/issues/11572 Change-Id: Ifbaf721050007db49bbd969dc669d070f4ce839e Reviewed-on: https://dart-review.googlesource.com/12622 Reviewed-by: Zach Anderson <zra@google.com>
30 lines
881 B
Dart
30 lines
881 B
Dart
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// part of "core_patch.dart";
|
|
|
|
// These Dart classes correspond to the VM internal implementation classes.
|
|
|
|
// Equivalent of RawAbstractType.
|
|
abstract class _AbstractType implements Type {
|
|
String toString() native "AbstractType_toString";
|
|
}
|
|
|
|
// Equivalent of RawType.
|
|
class _Type extends _AbstractType {
|
|
int get hashCode native "Type_getHashCode";
|
|
}
|
|
|
|
// Equivalent of RawTypeRef.
|
|
class _TypeRef extends _AbstractType {}
|
|
|
|
// Equivalent of RawTypeParameter.
|
|
class _TypeParameter extends _AbstractType {}
|
|
|
|
// Equivalent of RawBoundedType.
|
|
class _BoundedType extends _AbstractType {}
|
|
|
|
// Equivalent of RawMixinAppType.
|
|
class _MixinAppType extends _AbstractType {}
|