Open
Description
We have code like this in the core libraries _Future
implementation (from future_impl.dart)
void _asyncComplete(FutureOr<T> value) {
if (value is Future<T>) {
_chainFuture(value);
return;
}
_asyncCompleteWithValue(value as dynamic);
}
This code will be called with return values of async functions. At runtime the value
can therefore be of many different types. This causes an issue with this is Future<T>
check.
The is
check is performed via SubtypeTestCache
which have a maximum length of 100 and will fallback to runtime after that. Since value
will obtain many different class ids, the SubtypeTestCache
easily fills up and causes very slow performance.
Due to the fact that this will happen on pretty much any program which uses lots of async code, it's quite a severe issue.
See also b/182183059