带有 .NET 可执行文件的 NGEN x86 与 x64 [英] NGEN x86 vs x64 with .NET executables

查看:29
本文介绍了带有 .NET 可执行文件的 NGEN x86 与 x64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题:

我的 .NET 程序集是在 x86 模式下编译的.我还能在 x64 Windows 系统上利用 NGEN 的性能优势吗?x86 程序集会在 x64 上编译成本机代码吗?

My .NET assemblies are compiled in x86 mode. Can I still leverage the performance benefits of NGEN on x64 Windows systems? Will x86 assemblies be compiled into native code on x64?

推荐答案

使用 x86 编译的程序集将在 64 位系统上运行 i wow64,但使用 AnyCPU 编译的程序集将在本机运行,与 NGEN 无关.为 x86 编译的程序集可以在 64 位系统上加载 32 位程序集,而为 AnyCPU 编译的代码不会加载 32 位 dll.

Assemblies compiled with x86 will run i wow64 on 64-bits systems, but assemblies copiled with AnyCPU will run natively, regardless of NGEN. Assemblies compiled for x86 can load 32-bit assemblies on 64-bit systems and code compiled for AnyCPU will not load 32-bit dlls.

当您使用 NGEN 时,您将避免对程序集进行 JIT 编译,并且在 x64 系统上也使用 x86 编译时,程序集将是本机 x86 代码.

When you use NGEN you will avoid JIT-compiling of the assembly and the assembly will be native x86 code when compiled with x86 also on x64 systems.

这篇关于带有 .NET 可执行文件的 NGEN x86 与 x64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆