我正在尝试调查一个性能问题,即当应用程序在我们的一台服务器上以 64 位运行时运行缓慢,而在同一台机器上以 32 位或 64 位运行在其他任何地方时运行速度很快。
我发现这可能与所使用的 JIT 编译器有关。有什么方法可以告诉我正在使用哪个 JIT 编译器来运行我的应用程序?我想看看它在服务器上是否与在 64 位版本运行良好的其他计算机上不同。
最佳答案
JIT 版本
您可以按照 Hans 的步骤来验证 RyuJIT 是否已加载到您的应用程序中。 [2]
use the debugger to ensure you have the new version. First have a look-see at the runtime directory with Explorer, navigate to C:\Windows\Microsoft.NET\Framework64\v4.0.30319. You'll find the the two jitters there, clrjit.dll is new jitter based on the Ryujit project and compatjit.dll is the legacy x64 jitter.
Project > Properties > Debug > tick the "Enable native code debugging option". Use the Build tab and ensure you've removed the jitter forcing, the "Prefer 32-bit" option must be unticked, "Platform target" must be set to AnyCPU. And use the Application tab to pick the framework target.
Use Debug > Step Into to start debugging. Debug > Windows > Modules displays the list of loaded modules. Find the jitter DLLs back in that list, click the "Name" column header to sort by name. If you see compatjit.dll back then you are using the legacy jitter. Do note that you'll always see clrjit.dll, they both get loaded when the legacy jitter is used.
[2] https://stackoverflow.com/a/31534544/102351
JIT 架构
您可以通过检查正在运行的应用程序是否为 64 位进程来确定所使用的 JIT 的体系结构。
Environment.Is64BitProcess
https://msdn.microsoft.com/en-us/library/system.environment.is64bitprocess.aspx
此属性分别在 64 位和 32 位版本的 mscorlib 中实现为直接返回 true/false。 [1]
关于c# - 哪个 JIT 正在运行我的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39834570/