-
Notifications
You must be signed in to change notification settings - Fork 132
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your request related to a problem you have?
I think adding a cache in DefaultTypeResolver
can improve performance and memoery allocations.
Type.GetType(typeName); |
Describe the solution you'd like
private readonly ConcurrentDictionary<string, Type> _consumeTypeCache = new(StringComparer.Ordinal);
private readonly ConcurrentDictionary<Type, string> _produceTypeCache = new();
(...)
return typeName is null ?
null :
_consumeTypeCache.GetOrAdd(typeName, Type.GetType);
(...)
string messageTypeName = _produceTypeCache.GetOrAdd(
messageType,
static messageType => $"{messageType.FullName}, {messageType.Assembly.GetName().Name}");
context.Headers.SetString(MessageType, messageTypeName);
Are you able to help bring it to life and contribute with a Pull Request?
Yes
Additional context
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request