Fix ResourceManagerStringLocalizerFactory caching #33129
Conversation
The cache key was using reflection which was visible in allocation profiles since it's called for every view that is rendered.
|
||
var assembly = typeInfo.Assembly; | ||
return _localizerCache.GetOrAdd(resourceSource.AssemblyQualifiedName!, _ => |
sebastienros
May 29, 2021
Author
Member
This could just be Add
, worst case it's called more than once, but only on first concurrent requests.
This could just be Add
, worst case it's called more than once, but only on first concurrent requests.
The cache key was using reflection which was visible in allocation profiles since it's called for every view that is rendered.
Before:

After

Allocations