We heavily use reflection to dynamic load 100+ assemblies in our C# .NET 4.0 application.
We also have a performance metrics set up to gather various aspects of our application performance.
During scheduled windows update procedure, an update related to bulletin (http://technet.microsoft.com/en-us/security/bulletin/ms12-074) was applied to our servers.
Immediately we've seen a 2x decrease in performance for reflection and delay-loading DLLs.
Attached image shows reflection performance in milliseconds before and after the update was applied on 20/01/2013.
No other environment or code changes were made on those servers, so we assume that the performance impact was caused by applying KB2729449 (part of MS12-074bulletin, http://support.microsoft.com/kb/2729449 ) which includes (per MS description) some fixes in delayed DLL loading and reflection security aspects:
I would like to report our findings and clarify with appropriate .NET engineers whether this impact is known or expected.
Sample of code that can be used for reproducing this (should be set up to scan over 100+ assemblies):
// load assembly
assembly = Assembly.LoadFile(args);
foreach (AssemblyName r in assembly.GetReferencedAssemblies())
testAssembly = true;
The question is not in the implementation itself, but regarding the sharp 2x performance decrease in delay-loading and reflection we've seen after applying aforementioned updates.