Problem
A JetBrains IDE runs at 50-100% CPU after a project opens, and the whole computer becomes slow at the same time. Other applications stop responding while this lasts. Editors that do not build a project-wide index, such as Visual Studio Code, show no comparable slowdown on the same machine.
The slowdown is worst on the first start after an IDE update.
Cause
Indexing reads every file in the project, plus the interpreter or SDK files and the libraries. The IDE also loads its own code from disk while it starts and while features are used for the first time. On slow storage, or when a third-party antivirus scans each read, the disk cannot keep up. Every other process waits for the same disk, so the slowdown reaches the whole system. CPU usage near 80% is a symptom of that wait, not its cause.
The gap between a warm and a cold file cache shows how much of this is the disk. The same project scan can take 4 seconds warm and 148 seconds cold. A long interface freeze while the IDE loads its own code has the same cause.
An IDE update discards the index caches. The first start after an update therefore re-indexes the whole project once, which takes several minutes for a project of 26,000 files. Later starts are not affected.
Edition makes no difference here. The paid and free editions run on the same platform and use the same indexing engine.
Resolution
- Check the drive type in Task Manager | Performance | Disk on Windows. On a mechanical hard drive, indexing a large project saturates the disk. Move the project and the IDE caches to an SSD. Changing IDE default directories used for config, plugins, and caches storage covers the cache relocation.
- Check which antivirus is active. Real-time protection turned off in Windows Defender means another product took over file scanning. Add exclusions for the project folder, the IDE caches directory, and the IDE installation folder. See Antivirus Impact on Build Speed and Slow startup on Windows: splash screen appears in more than 20 seconds.
- Keep generated files out of the project folder. Every write inside the project can start another scan, so a script that writes its output there keeps the IDE re-scanning for the whole session. Right-click such a folder in the Project tool window and select Mark Directory As | Excluded.
- To keep the rest of the system responsive during indexing, limit the cores the IDE uses. Open Help | Edit Custom VM Options, add
-XX:ActiveProcessorCount=4, and restart the IDE. On a 6-core CPU this leaves 2 cores for other processes. Indexing then takes longer. - After an IDE update, let the re-index finish once without interrupting it.
- If the slowdown remains, follow the heap, plugin, and runtime steps in JetBrains IDE causes constant high CPU usage. That article also lists what support needs: the log archive from Help | Collect Logs and Diagnostic Data, and a CPU snapshot taken while the slowdown is happening.
Comments
0 comments
Please sign in to leave a comment.