Unity-Technologies / ProjectAuditor

Project Auditor is an experimental static analysis tool for Unity Projects.
Other
822 stars 68 forks source link

[Performance] Window OnEnable() is slow #57

Open unitystevem opened 3 years ago

unitystevem commented 3 years ago

My most recent Project Review, which focused heavily on Editor performance and iteration times, showed that the Project Auditor window's OnEnable() method is relatively expensive. Definitely not the worst offender, but it would be good to improve this if possible. This is what it looks like with the PA window open when you make a small code change and the assembly reload process refreshes all of the open windows in the Editor. Taken from Profile Analyzer, and filtered by OnEnable() . This impacts assembly recompilation/reload after every code change, and entering/exiting Play Mode if domain reload is not disabled.

OnEnableCosts

mtrive commented 3 years ago

Since this is a real world project, ~139ms does not look to bad to me, no? Reloading assemblies usually take much longer, in the order of seconds so, to be honest, I am not sure it's worth optimizing the ProjectAuditorWindow.OnEnable. If you agree, I'd rather improve the time it takes to analyze a project.

unitystevem commented 3 years ago

I agree that it's not an enormous problem, although that cost does impact every single iteration event in Unity, and (aside from the Settings Window, which is pretty terrible), Project Auditor is the most expensive window to refresh that I've seen.

I agree that focusing on project analysis time should be higher priority. Are you suggesting that we put this issue at the bottom of the priority list, or that it should just be closed as "by design"?

mtrive commented 3 years ago

I would not close as "by design". I would definitely like to profile the OnEnable as well as the de/serialization of the report data on a large project since they can both impact iteration times and they are tightly coupled.