Fix major performance regression in legacy struct marshalling APIs (#81941)
authorJan Kotas <jkotas@microsoft.com>
Fri, 10 Feb 2023 16:57:30 +0000 (08:57 -0800)
committerGitHub <noreply@github.com>
Fri, 10 Feb 2023 16:57:30 +0000 (08:57 -0800)
commit38f635a5f70e2c41ba5093e5c687e1a8c0a7fc53
tree0d67a86eb7800dc1c29ea75bc3d552385d42eeef
parentc4156f847517445a67032dbd135709f312c8745e
Fix major performance regression in legacy struct marshalling APIs (#81941)

* Fix major performance regression in legacy struct marshalling APIs

This change adds a simple cache for the marshalling stubs. This cache improves performance of the test mentioned in the issue by 20+x.

Fixes #45100

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
src/coreclr/vm/dllimport.cpp
src/coreclr/vm/loaderallocator.hpp
src/coreclr/vm/marshalnative.cpp
src/coreclr/vm/mlinfo.cpp
src/coreclr/vm/mlinfo.h