c# - 哪个 JIT 正在运行我的应用程序

标签 c# performance

我正在尝试调查一个性能问题,即当应用程序在我们的一台服务器上以 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]

[1] https://stackoverflow.com/a/1913908

关于c# - 哪个 JIT 正在运行我的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39834570/

相关文章:

SQL 服务器 : query runs very slowly (up to 20 seconds)

c# - 以编程方式将应用程序添加到所有配置文件 Windows 防火墙 (Vista+)

c++ - 优化 “coincidence search”算法以提高速度

c# - IOException 与检查 File.Exists?

performance - MATLAB 稀疏性 - 在我的情况下有速度优势吗?

c# - 用于 C# asp.net 的分析/性能分析的免费或廉价选项?

c# - 控制台应用程序中的简单菜单

c# - 在 RichTextBox 中附加文本和图像

c# - 使用 UseInMemoryDatabase 的 Entity Framework Core 迁移错误

c# - 如何防止在 ASP :Textbox? 中自动填充以前的数据