"all those () `clone()`s added up to no more than a minuscule overhead in real world workloads"

@lupyuen This is very misleading. It highly depends on what you are cloning and how often at runtime (in a hot loop for example?)

Clone while learning or prototyping. Don't get stuck on premature optimization.

But cloning has a performance overhead and you should be aware of that when you want to release your code. Whether that overhead is significant is highly dependent on your specific code.


@lupyuen IMHO this article provided an old, boring but cannot-be-wrong conclusion:

the performance (of clone) depends on the actual workload.

The author listed some scenarios they think clone() is better. My knowledge is limited so I can’t comment much. I can say that if the memory-sharing is guarded by terribly designed locks, its performance will be worse than the naive clone() approach

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.