4f925105cf
Previously, the VM used a linear array to cache previous instantiations of a type arguments object. Now once the cache hits a certain number of occupied entries, the VM changes to using a hash-based approach. The InstantiateTypeArguments stubs have not yet been updated to traverse the hash-based cache, so once the cache has grown too large, all attempts at instantiations, even those that are in the cache, go to the runtime. Thus, until the stubs are updated, this is only an improvement if the cost of traversing the linear cache dominates the cost of making a runtime call. Our benchmarks see a ~40% performance regression for hash-based caches of size 100 but a ~400% performance improvement for hash-based caches of size 1000. Thus, we currently split the difference and set the maximum size of linear caches to 500. TEST=vm/cc/TypeArguments_Cache_ManyInstantiations Bug: https://github.com/dart-lang/sdk/issues/48344 Change-Id: I7f1376943523bb5bcd8b175cfb1936779ea73d60 Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-debug-simriscv64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-tsan-linux-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265325 Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com>