Editor script compilation post lag

I have a project that is pretty big and I’m trying to organize it to speed it up. The issue I’m running into is there is this long pause after script compilation that happens and I’m trying to understand what’s causing the lag.

So what I’ve done is used some scripts to determine that the actual script compilation completes in like 4 seconds, but the editor stays frozen for an additional 11 to 20 seconds after script compilation. I check the status of EditorApplication.isCompiling and it stays true during this period, but I can’t figure out what the reason is. Can someone point me to some good documentation on what happens during and after the script compilation process? I read online that an update happens, but is it a regular engine update because that shouldnt take 20 seconds to complete.

I forgot to add that it’s a blank scene, I know having prefabs in a scene cause some lag due to it having to check all of the assets in a scene.

I found one of my biggest offenders by looking for scripts with [InitializeOnLoad] in them. It lowerd my time down to about 7.8 seconds now instead of 17 to 20. To fix those, I searched and replaced [InitializeOnLoad] with /////[InitializeOnLoad] and will slowly review each script with /////[InitializeOnLoad] and uncomment [InitializeOnLoad] if I think its necessary or fix the code.

there is still about ~4 seconds on top of the 4 that I don’t know whats going on though…