Evaluate whether use of COR_PRF_MONITOR_ENTERLEAVE should be replaced by COR_PRF_ENABLE_REJIT
Closed this issue · 1 comments
We're using in the default (non-light) mode COR_PRF_MONITOR_ENTERLEAVE
instead of COR_PRF_ENABLE_REJIT
. According to the documentation I'd expect that the latter.
Using the non-light mode caused problems at one of our customers when executing tests with the Tosca Classic DotNet engine (not TBox). Tosca cannot connect to the application due to a DLL injection error. Switching to light mode (and thus not monitoring enter/leave events) fixes that problem.
According to @karottenreibe we have to verify that exchanging the flags still produces correct output if the assembly is pre-jitted with ngen.exe
. It would also be nice to have a performance comparison.
I checked this out. A quick test with Pinta revealed:
- COR_PRF_MONITOR_ENTERLEAVE is totally unnecessary. It causes most of the slowdown we previously saw with non-light-mode
- COR_PRF_ENABLE_REJIT is not what we want, it just enables calls to the RequestRejit method (https://docs.microsoft.com/en-us/dotnet/framework/unmanaged-api/profiling/icorprofilerinfo4-requestrejit-method)
- COR_PRF_DISABLE_ALL_NGEN_IMAGES does what we want: it disables the native image cache, thus forcing all assemblies to be JIT compiled
specifying COR_PRF_DISABLE_ALL_NGEN_IMAGES instead of COR_PRF_MONITOR_ENTERLEAVE gives a noticable performance boost. It still feels a little bit slower than light mode but not by much. Will change our code to use this flag