How do I prevent NGEN from rebasing my code (negatively affecting performance)?

假装没事ソ 提交于 2019-11-30 16:32:12

According to this Microsoft blog, "There may be some marginal cases where setting base addresses in Vista+ OSes has a benefit, but these can be largely ignored." So, while using ngen does improve startup times, it is no longer necessary to set the base addresses unless you support pre-Vista OSes. This is a side-effect of the new Address Space Layout Randomization security feature.

The relocating of your DLLs only occurs at load time, once loaded there are no further performance hits due to the relocation process. Of course depending on the number and size of the DLLs (the number of relocations) the load time can be significantly impacted, which is a problem is your application is frequently started and stopped.

Rebasing DLLs to improve load times requires continous monitoring and tuning, if you have not left enough head room between DLL load locations you end up with collisions as the DLLs grow or new DLLs get added to the project.

Here is an MSDN article discussion ways to improve application startup time. http://msdn.microsoft.com/en-us/magazine/cc163655.aspx

Kent Boogaart

NGEN allows you to specify a base address (also exposed in VS settings). If you're going to NGEN, you basically want to ensure you don't have any overlap between DLLs. If you have overlap, then the CLR will be forced to rebase them when they're loaded.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!