Open adambajguz opened 11 months ago
I think adding a cache in DefaultTypeResolver can improve performance and memoery allocations.
DefaultTypeResolver
https://github.com/Farfetch/kafkaflow/blob/d662b9dde9d627a7ef6db795368eec5b58f96ba1/src/KafkaFlow.Serializer/DefaultTypeResolver.cs#L15
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);
Yes
No response
Also why DefaultTypeResolver is basically a transient dependency?
Is your request related to a problem you have?
I think adding a cache in
DefaultTypeResolver
can improve performance and memoery allocations.https://github.com/Farfetch/kafkaflow/blob/d662b9dde9d627a7ef6db795368eec5b58f96ba1/src/KafkaFlow.Serializer/DefaultTypeResolver.cs#L15
Describe the solution you'd like
Are you able to help bring it to life and contribute with a Pull Request?
Yes
Additional context
No response