Improvements to Domain Reload performance

hcorion 8 months ago updated by STARasGAMES 1 month ago 2

Hey there, so I decided to check out Unity's Editor Iteration Profiler to see where I was losing time in my compiles, and it seems to me that Peek (and Unity Visual Scripting, but that's a different issue) is taking by far the most amount of time during the domain reloads, I've attached an image below. (It also appears at the top of some of the other expensive stack traces)

I'm hoping some effort can be done to improve the domain reload performance? The ease of use of Peek might not be worth it for me if I have to sacrifice iteration time.

Unity Version:
Unity 2021.1.3f1
Peek Version:

Hello hcorion, thanks for the report and apologies for the delay.

Unfortunately, this is caused by the initialization cost of Odin Serializer, which Peek uses to serializes its settings. This is costly because Odin Serializer does a lot of initial caching to be extremely fast in later frames, but unfortunately we pay the full cost up front as we only need it on assembly reload.

In the future, I'd like to move away from Odin Serializer and resort to simply built-in Unity serialization. This is however a large endeavour and can't be easily done without some major refactoring.

Almost a full second on each script compilation... Just to serialize settings? LOL
I would suggest making this a high-priority issue. While other not experienced users might not know the source of the long compilation time, I'm sure this negatively impacts them.

Unity Version:

Peek Version: