Assmbley Deployed in GAC has performance benefit?
In my asp.net application I'm referring around 50 assemblies ( 20 compiled class libraries & 30 3rd party assembly), If i deploy my assemblies in GAC rather than BIN, will i get any performance benefit.?, If so is that a signi开发者_C百科ficant amount?
You might experience improved load performance for strong named dlls when having them in the GAC. The reason is that .NET does a hash verification of strong named dlls dll when the dll is loaded. However, if the dlls is in the GAC .NET assumes that hash verification was already done at the time the dll was put into the GAC.
Another area where you could get improved load performance is if you application has several appdomains. You can then instruct .NET to share strong named named dlls across the AppDomains instead of loading them one per AppDomain thus saving memory and load time.
See this link for more info: http://msdn.microsoft.com/en-us/magazine/cc163655.aspx
There is no performance benefit. Whenever CLR attempts to locate an assemby file, it always looks in application directory first.
You put assemblies in GAC if they are to be used by multiple apps.
Edit:
I need do correct my answer.
CLR will look for assembly in GAC first. Correct order looks like this:
GAC
AppDir\AssemblyName.dll
AppDir\AssemblyName\AssemblyName.dll
AppDir\anyOfPrivatePathsConfigured\AssemblyName.dll
AppDir\anyOfPrivatePathsConfigured\AssemblyName\AssemblyName.dll
So maybe there is performance benefit but I doubt it's measurable. And I wouldn't advice putting assemblies in GAC for performance benefit.
No, the GAC only provides a way to share assemblies across applications (they don't need their own local copy, and updates only need to be applied in one location).
You should look at NGen (JIT'ing) if you need better performance.
精彩评论