通过不再验证来自受信任位置的程序集的强名称,.NET 3.5 SP1 获得了改进的启动性能。在我的书中有点争议,但有点站得住脚。
我确实检查了 64 位版本的 CLR 是否也绕过了那个耗时的步骤。签署一个 DLL,将其放入 GAC,然后修补一个字节。加载组件时没有投诉。因此,解释差异的不是 SP1 启动首选项的改进。
启动时间中的其他因素是: - 从磁盘加载 CLR(仅限冷启动) - 依赖程序集的 Groveling - JIT 编译启动代码
冷启动很可能是一个因素,您可能没有运行其他加载了 64 位版本的 CLR 的进程。通过在进行测试时运行虚拟 .NET 应用程序可以轻松消除。
Groveling assemblies could take longer for the same reason. It is unlikely that the 64-bit ngen-ed images of the .NET assemblies are in the file system cache. Again, easy to eliminate with the dummy app having a dependency on the same assemblies.
The 64-bit JITter is a tougher nut to crack. An arbitrary call is to assume that MSFT didn't spend as much time making that one performant as the 32-bit JITter. Nothing backed-up by any evidence though. Difficult to measure too, you'd have load an assembly with Assembly.Load, then time Activator.CreateInstance() where the class constructor calls as much code as possible.