问题标签 [ngen]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - 在 ASP.NET 工作时无法获得 NGen
我正在尝试将 NGEN 与 ASP.NET 应用程序一起使用以缩短启动时间。(我很欣赏这不是一个理想的解决方案,但我被要求调查它)
我可以针对我的目标 DLL 运行 nGEN,现在收到消息“所有编译目标都是最新的”。
但是,当我尝试通过启动应用程序并使用程序集绑定日志查看器(在日志类别中勾选本机图像)来验证这是否有效时,我没有看到任何我的应用程序列出,这表明它不工作由于某些原因。
我确信我遗漏了一些明显的东西,有人知道我可以验证是否正在使用 NGEN 图像的方法吗?
c# - NGEN x86 与带有 .NET 可执行文件的 x64
我有以下问题:
我的 .NET 程序集是在 x86 模式下编译的。我还能在 x64 Windows 系统上利用 NGEN 的性能优势吗?x86 程序集会在 x64 上编译为本机代码吗?
.net - .NET - NGEN 编译 x86 程序集
这是对这个问题的跟进:
我知道 NGEN 可以使用自定义设置操作,但我使用 Inno Setup,所以我必须手动进行。
问题:如果我的程序集是在 x86 模式下编译的,我应该始终使用 x86 版本的 ngen.exe,还是取决于操作系统(x86 Windows 上的 x86 ngen.exe 和 x64 Windows 上的 x64 ngen.exe)?
问题是我在安装 NGEN 时遇到以下错误:
编译程序集 C:\Program Files\MyApp\MyApp.exe (CLR v4.0.30319) ... 01/15/2012 15:05:28 [2432]: 1> 编译 C:\Program Files\MyApp\MyApp 时出错。 exe:此版本与您运行的 Windows 版本不兼容。检查您计算机的系统信息以查看您是否需要 x86(32 位)或 x64(64 位)版本的程序,然后联系软件发行商。(来自 HRESULT 的异常:0x800700D8)
理想情况下,我想将主程序集 (x86) 及其所有依赖项(混合 x86 和 AnyCPU 构建)编译为本机代码。
请指教。
winforms - nGen EXE +DLLs 通过设置和部署项目
我有这个代码应该nGen 我的主要应用程序 EXE:
我需要的是不仅EXE是nGen'd,而且所有引用的DLL(我的整个解决方案)也得到nGen'd
假设我的 EXE 项目被称为:
这取决于这些:
我怎样才能通过解决方案中唯一的部署项目来生成这些?
谢谢。
.net-4.0 - 用于部分信任应用程序的 NGen
我有一个 .Net 4.0 应用程序,我需要提高在部分信任环境中运行的代码的性能。具体来说,我想消除运行时 JIT 的需要。通常这是使用 NGEN ( http://http://msdn.microsoft.com/en-us/library/6t9t5wcf(v=vs.100).aspx ) 完成的,但这不适用于以部分信任运行的程序集. 我还有其他选择吗?
c# - ngen 创建的本机映像的 GAC 文件路径
NGen 在 GAC 中创建文件,路径如下:
C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\ca87ba84221991839abbe7d4bc9c6721\mscorlib.ni.dll
GUID 来自哪里?它与程序集的MVID有关吗?
有相关的问题,但他们错过了这个细节。我可能错过了另一个
对于 ref,这是在使用 windbg 验证是否在两台机器上加载相同的 dll 版本时出现的。
clickonce - 是否可以预先生成 NGen 图像以便客户不必这样做?
我们的应用程序通过 ClickOnce 分发,平均需要10.8 秒才能启动。在ngen
.exe(在 ClickOnce 安装到的目录中)上运行后,它平均在6.4 秒内启动。这显然是一个巨大的加速(40%),如果可能的话,我想使用 ngen-ification。
Ron 对Is it possible to use NGen with ClickOnce deployment的回答?展示了如何在客户的机器上完成它,假设我猜他运行的是Windows XP,因为它需要我的Windows 7机器上的管理员权限,所以这似乎不是一个通用的解决方案。
此外,在我的机器上,ngen 需要40 秒来编译属于该应用程序的所有程序集。
所以理想情况下,我想为所有(主要)架构预先生成我们的应用程序,作为构建过程的一部分,这样它就可以交付给客户,而无需用户接受“可以以管理员身份执行?” 弹出,然后等待 40 秒。
那可能吗?
c# - How is .NET JIT compilation performance (including dynamic methods) affected by image debug options of C# compiler?
I am trying to optimize my application for for it to perform well right after it is started. At the moment, its distribution contains 304 binaries (including external dependencies) totaling 57 megabytes. It is a WPF application doing mostly database access, without any significant calculations.
I discovered that the Debug configuration offers way better (~5 times gain) times for most operations, as they are performed for the first time during the lifetime of the application's process. For example, opening a specific screen within the app takes 0.3 seconds for NGENed Debug, 0.5 seconds for JITted Debug, 1.5 seconds for NGENed Release and 2.5 seconds for JITted Release.
I understand that the gap in JIT compilation time is caused by the JIT compiler applying more aggressive optimizations for the Release binaries. From what I can tell, Debug and Release configurations differ by the /p:DebugType
and /p:Optimize
switches passed to the C# compiler, but I see the same performance gap even if I build the application with /p:Configuration=Release /p:DebugType=full /p:Optimize=false
– that is, the same image debug options as in /p:Configuration=Debug
.
I confirm that the options were applied by looking at the DebuggableAttribute
applied to the resulting assembly. Observing the NGEN output, I see <debug>
added to the names of some assemblies being compiled – how does NGEN distinguish between debug and non-debug assemblies? The operation being tested uses dynamic code generation – what level of optimization is applied to dynamic code?
Note: I am using the 32-bit framework due to external dependencies. Should I expect different results on x64?
Note: I also do not use conditional compilation. So the compiled source is the same for both configurations.
.net - 可以在构建之间持久保存 MPGO 数据吗?
我刚刚阅读了一篇关于 MPGO(托管配置文件引导优化)的帖子,描述的过程是:
- 获取一台装有 Visual Studio 11 Ultimate Beta 和您的应用程序的机器。
- 使用必要的参数运行 MPGO 工具(以管理员身份):在文件夹
MPGO -scenario MyLargeApp.exe -AssembyList *.* -OutDir C:\Optimized\
中创建优化的 IL 程序集。C:\Optimized
- 使用每个应用程序 DLL 的必要参数运行 NGen 工具(以管理员身份):
NGEN.exe myLargeApp.exe
- 运行您的应用程序——它现在将使用优化的本机图像。
这似乎意味着您必须对进入您已发布产品的二进制文件执行指导方案。
在构建过程中需要手动干预对我来说没有意义。有没有办法执行一次指导场景,然后提交生成的数据,以便在将来的构建中自动插入到编译的程序集中?
.net - 未加载使用 NGEN 创建的 .NET 本机映像
我使用 NGEN 创建了我的应用程序使用的几个程序集的本机图像。但是,这些图像在运行应用程序时没有加载,我不知道为什么。
这是来自 fuslogvw 的典型日志:
以及来自 ngen.exe 关于该程序集的信息:
我使用了位于 C:\Windows\Microsoft.NET\Framework\v4.0.30319\ 中的 ngen.exe,我的程序集的目标框架是 .NET Framework 4。创建本机映像后,我没有重新编译程序集。
任何帮助,将不胜感激。