AttributeHelper.ExtractMenuCommands() taking a long time to run in a very large project

Our project is huge, lots of assets, lots of small individual code files with many methods (modular code is good).

I had an issue with 4000 warnings causing our compilation times to take 7 extra seconds than it needed to and now I’ve found this that is taking 4 extra seconds. Iterating on all the methods in an assembly is insane and I’m fairly confident this is the problem but just in case I’ll ask.

Anyone know if there is something else that could be affecting it’s performance? Inspecting the UnityEditor.dll seems to show it’s not doing much except collating data.

I think for the time being I’ll rewrite some of the IL code to require classes that implement MenuItem to implement IMenuItem to save on the iteration but Unity really has to get on this.

Same thing happens. Unity 5.5.2p4
Cannot find why is this happens because profiler in deep profiler mode is stuck trying to open first element.

In my case this was caused by Unity, that begins to call OnEnable() function on some of my classes inherited from Editor after each compilation even on the empty scene.
Some of this editors have a lot of stuff in OnEnable() (like populating list of items from config). I do not know why Unity started to do this. Solved this by implementing lazy init of required data. So it populated in OnInspectorGUI functions.

This is caused by ExtractMenuCommands iterating over all methods in Unity 5.5, not just static ones. It’s fixed in Unity 5.6.