I have custom class that extends AssetPostprocessor and implements OnPostprocessModel().
Inside OnPostprocessModel() I have a loop that make ~1000 iterations, logging small string during each iteration.
Why when I try to use this single Debug.Log() call → Unity hangs forever (I waited for 10m!!!). As soon as I remove this single Debug.Log() → it finishes job in seconds.
Why on Earth Debug.Log() is so slow/glitchy?
Debug.Log is slow and has always been slow. It is slow because it does a call into the Editor and performs a stacktrace so you can see where the log was called from. It also calls objects ToString method to convert them to text, and does Type checks and Null checks. Thousand debugs at once would certainly freeze the editor for some time, that is absolutely expected.
The others have pointed out very good solutions to your issue in the comments.