Page 1 of 1

Improving saver registration performance

Posted: Fri May 12, 2023 9:21 pm
by szczepan
I noticed that on a scene with large number of savers, performance can drop significantly when adding additional savers - in my case when a new object is spawned. This is caused by calling Contains method on a List here:
public static void RegisterSaver(Saver saver)
{
if (saver == null || m_savers.Contains(saver)) return;
m_savers.Add(saver);
}

This could be improved a lot if HashSet was used instead of a List. I attached rough implementation for you evaluation.

Re: Improving saver registration performance

Posted: Fri May 12, 2023 9:49 pm
by Tony Li
Hi,

That sounds like a good optimization. I'll get it into the next release. Thanks for the suggestion!