Slow linear scan when instantiating types / unlimited size type instantiation cache #48344
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
type-performance
Issue relates to performance or code size
Right now we have a linear cache stored on uninstantiated
TypeArguments
objects that is consulted when code wants to instantiate it with instance/function type arguments vectors. The linear cache doesn't have a limit, see TypeArguments::InstantiateAndCanonicalizeFromFor most classes this is not a problem due to the limited number of actual instantiated TAVs.
Though for some classes that are instantiated with many different types, this linear search can become a performance issue. One issue identified is in our Future implementation:
There can be many different values for
T
andS
(~ as many different return types there are forasync
functions). This can cause significant slowdown of larger apps.Though this is of course not limited to
Future
related code - it's an issue for any class that is used with many different types. I imagineHashMap
suffering from the same, which usesThe text was updated successfully, but these errors were encountered: