Okay, so this is not the best practice situation, but luckily I have an answer, so please bear with me.
I'm working on a rather large Delphi project with lots of external APIs used. Those APIs are plugged in different ways, including units wrapped into IFDEFs in the DPR itself, when they are platform-dependent. Having IFDEFs in DPR is a bad practice - sure, but it is handy to have all the units listed in the project tree to switch between them (rather than switch between projects).
So I was adding another alternative API implementation to the project and as usual - wrapped the existing solution units into the {$IFDEF SOME_API_DLL}
clause and a new solution units into another {$IFDEF SOME_API_EXE}
.
Anyways, I noticed soon after, that the IDE started to freeze semi-randomly after just 3-5min of coding, which is unbearable toll.. The IDE would hog one CPU (e.g. 13% on 8-core PC). I was able to isolate the cause to be invocation of "autocomplete", "code completion" (Ctrl+Space) and "jump to declaration (Ctrl+Click).
The main question is - what could cause the IDE to freeze on how to resolve this?
I'm using Delphi XE8, but switching to other versions didn't help. Unfortunately newer 10.3+ versions (with claimed rewritten Code Insight) could not be tested/used due to third-party components.