Commit 444cf2f
authored
Optimize ResourceContainer/AssemblyLoadEventHandler methods, remove allocs (#9822)
* Rename _registeredResourceManagers -> s_registeredResourceManagers
* Use StringComparer.OrdinalIgnoreCase instead of name lowering
* Avoid double dictionary lookup in UpdateCachedRMW
* Use proper lookup in GetResourceManagerWrapper (value can never be null)
* Use proper variable names, set as readonly variables that are never set again
* Mark UpdateCachedRMW and GetResourceManagerWrapper as static functions
* Use string.create for key creation with initial buffer
* Save 100ns by using faster byte2hex function
* Save additional 200 bytes or more in allocations
* Formatting changes only
* Shave off 300ns per invocation, allocation-free in 99.9% cases
* Seal the class, remove redundant usings, final formatting changes/comments only
* GetResourceManagerWrapper is mostly just using key for lookup, no reason for string
* Revert the StringComparer.OrdinalIgnoreCase usage because of Span<char> buffer
* Fix original comment typo
* Fix a few more comments, revert list separator
* Fix usings post-merge1 parent 2c8c0c0 commit 444cf2f
File tree
2 files changed
+157
-175
lines changed- src/Microsoft.DotNet.Wpf/src
- PresentationFramework/MS/Internal/AppModel
2 files changed
+157
-175
lines changed
0 commit comments