How to debug unity editor performance?

I am well aware that running a game inside the editor is worse on performance than if I built a stand alone build, but of course some times it is impractical to build every time I need to run the game. However, lately I have been having an issue in my project where every time I hit play, editor performance gets worse. There are spikes every X seconds, the first time I play, they last 0.1s, then after running the game in editor 3-5 times they get up to .25, then .5, then 1, etc and keep getting worse. I can tell that the issue is in editor because the profiler clearly shows the spikes in the editor segment. The issue also doesn’t occur in stand alone builds.

I assume it is an issue of some static value in my game or editor scripts that isn’t getting cleared in between play sessions in editor, but since the editor segment in the profiler doesn’t give me a breakdown like the rest of the game, I am having a really hard time tracking down where the issue is occurring.

Does anyone have any tricks or suggestion for debugging untiy editor performance?

There are no static values what are not cleared up. Whenever Unity compiles your scripts everything is completely destroyed. The whole managed Mono environment will be taken down and restarted. Are you sure you don’t have anything related to threads that you don’t end gracefully? Threads are usually the only things that may cause issues when not properly ended.

Though we don’t know anything about your project, so it’s difficult to say anything about it. Have you actually run a deep profile?