Investigate Clone performance #4863
Conversation
Introduced the ISerializationCloner interface to support efficient object cloning via serialization. Updated MobileFormatter to implement this interface and provided a Clone method using DTO serialization. Refactored ObjectCloner to use the new interface when available, with fallback to the previous approach. Removed unused usings in MobileFormatter.cs.
Removed the <ItemGroup> that updated Nerdbank.GitVersioning to version 3.9.50 in Csla.Benchmarks.csproj. No other changes were made.
StefanOssendorf
left a comment
There was a problem hiding this comment.
Thanks for the PR. I'll have to take a deeper look in the next days but skimming through the test classes you are going all out :D
| /// Defines an object that can clone objects via serialization of | ||
| /// object graphs with improved performance. | ||
| /// </summary> | ||
| public interface ISerializationCloner : ISerializationFormatter |
There was a problem hiding this comment.
I think this implementation chain is not right.
A Cloner is not a SerializationFormatter.
So I think it would be better to make it an independent interface and MobileFormatter implements both. Your check in the ObjectCloner would still work and the concepts wouldn't be mixed.
Maybe @rockfordlhotka has an opinion on that?
There was a problem hiding this comment.
I thought about that, and for me it is a formatter with more features, and not another service, if I remove the inheritance from ISerialization formatter I need to change the code to look for 2 different services in the service provider
Changed FetchAndSerialize and FetchAndCloneInternal from async Task<object?> to synchronous object? methods in PerformanceClonerBenchmark.cs, removing async/await usage.
…m/luizfbicalho/csla into feature/cloner-update-performance

PR to add the performance improvements to
clone method
#4272