Have you ever used ngen.exe?

后端 未结 8 1112
感动是毒
感动是毒 2021-01-31 07:40

Has anybody here ever used ngen? Where? why? Was there any performance improvement? when and where does it make sense to use it?

8条回答
  •  执笔经年
    2021-01-31 08:29

    I don't use it day-to-day, but it is used by tools that want to boost performance; for example, Paint.NET uses NGEN during the installer (or maybe first use). It is possible (although I don't know for sure) that some of the MS tools do, too.

    Basically, NGEN performs much of the JIT for an assembly up front, so that there is very little delay on a cold start. Of course, in most typical usage, not 100% of the code is ever reached, so in some ways this does a lot of unnecessary work - but it can't tell that ahead of time.

    The downside, IMO, is that you need to use the GAC to use NGEN; I try to avoid the GAC as much as possible, so that I can use robocopy-deployment (to servers) and ClickOnce (to clients).

提交回复
热议问题