Xline
Xline

Reputation: 812

For cloning purposes, when does serializing outperform cloning?

Assume the existence of a graphical model instance which I want to clone it often for processing (a.k.a inference) purposes. I had several issues with poor performence with deep cloning till I used serialization. I was not believing in serialization (as another approach for cloning) till I tried it.

This brings me to the question: When it is advisable to serialize instead of deep clone? is there any threshold or tradeoff I should first examine in order to come up with the choice?

I am trying to comprehend this to advise my students on best practices in such situations.

Upvotes: 2

Views: 79

Answers (1)

Evgeniy Dorofeev
Evgeniy Dorofeev

Reputation: 136062

Serialization is expensive because it needs to analize object's class. Cloning is always faster.

Upvotes: 1

Related Questions