I would buy a more powerful computer. I have a project with 34908 files and IntelliJ doesn't care. Not quite 40_000+ files but still a lot :).
Also with IntelliJ I make fewer mistakes. This "thing" is just more intelligent than I am. Add "SonarLint" to the game and I sometimes don't even know _why_ I am wrong :P.
Also I think "Avoid IDE lock-in of your project" is the wrong subtitle for the following paragraph. You would have the same problems by using just a text editor.
Rd6n6 mentioned refactoring. Do that in an editor and you will go crazy after a while :).
I love and hate my IDE :).