我有以下问题:
我的 .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
发布评论