CLion 2024.3 Help

Performance tuning tips

This article gives a summary of helpful techniques that you can use to improve CLion performance on large-scale projects.

Enable CLion Nova

CLion Nova is an improved version of CLion that uses the ReSharper C++/Rider C++ language engine instead of the legacy CLion Classic engine. It provides better responsiveness, accuracy, and performance for the IDE.

CLion Nova is enabled by default for new users. If you are using CLion Classic and would like to try CLion Nova, click the IDE and Project Settings button () on the toolbar and then click Switch to Nova Engine:

Switch to CLion Nova via the toolbar

You can also enable CLion Nova in Advanced Settings.

We also recommend using the latest version of the IDE with CLion Nova enabled. For example, various improvements in v2024.3 have reduced CLion Nova’s memory usage and improved overall IDE performance compared to v2024.2. This is especially noticeable in large projects like Chromium ones.

Increase memory heap

Enable memory indicators

You can check whether performance slowdowns are caused by low heap memory by monitoring two indicators in the bottom right corner of the status bar: the general Memory Indicator and the Clangd Memory Usage indicator.

  1. Press Ctrl+Shift+A to open the Find Action dialog.

  2. Start typing memory, then enable two options, Show Clangd Memory Usage and Show memory indicator:

    Search for memory indicators in                 Run Anything
  3. CLion will add the indicators to the status bar:

    Clangd memory indicator
    Memory indicator

Increase heap in the Change Memory Settings dialog

  1. Select Help | Change Memory Settings from the main menu.

  2. In the dialog that opens, set a higher memory heap value in the Maximum Heap Size field.

  3. Click Save and Restart.

Increase memory heap from Toolbox

You can also change the heap size from the Toolbox app:

  1. In Toolbox, select your CLion version and click the screw nut button on the right.

  2. From the menu that opens, select Settings:

    CLion settings in JetBrains Toolbox
  3. Go to the Configuration section and set a new value in the Maximum heap size field:

    Change CLion                 heap size from JetBrains Toolbox
  4. Restart CLion.

Adjust -Xmx

Another option to increase memory heap is to modify the corresponding JVM option, -Xmx:

  1. In the main menu, go to Help | Edit Custom VM Options - this action will create a copy of the .vmoptions file in the IDE config directory and open it in the editor.

  2. Set -Xmx to a higher value. For example, -Xmx4096m for 4 GB value instead of the default 2 GB.

  3. Restart CLion.

CLion also warns you if the amount of the free heap memory is less than 5% of the maximum heap size:

Low memory warning

Click Configure to edit -Xmx in the Memory Settings dialog.

Change the amount of memory allocated for Clangd

  1. Press Ctrl+Shift+A to open the Find Action dialog.

  2. Search for Registry:

    Searching for Registry in Find Action
  3. In the Registry dialog, start typing clion.clangd.max.memory.

  4. Set the desired value and close the dialog.

    Clangd memory registry keys

Speed up code analysis

On-the-fly code analysis is one of the most performance-consuming processes in CLion. Here's what you can do to lighten it up.

Tune analysis for a file

On-the-fly code analysis is one of the most performance-consuming processes in CLion. To lighten it up, you can configure the highlighting level for the currently opened file: none, syntax, or all problems. Use the inspection widget in the upper-right corner of the editor:

Inspection widget

Toggle Power Save mode

As an alternative to configuring individual checks or files one by one, try Power Save Mode. It disables all inspections and other highly-consuming background tasks for the entire IDE.

To enable Power Save Mode call File | Power Save Mode.

Power save mode ON

Check the Clangd-based engine

CLion incorporates a complementary Clangd-based language engine which is enabled by default. Currently, it works for error/warning annotation, certain navigation tasks, code formatting via ClangFormat, and code highlighting with quick-fixes.

In most cases, Clangd-based engine works faster than the built-in one (and sometimes provides more accurate results). However, it is not used for all operations. For example, Clangd provides the location for a quick-fix, while the fix itself is performed by the CLion’s own engine. Or, Find Usages employs Clangd to search through the files currently opened in the editor and the CLion’s own engine for all other usages.

We recommend you take Clangd engine specifics into account when investigating performance issues. Use Settings | Languages & Frameworks | C/C++ | Clangd to experiment with the engine settings and see if they affect the performance on certain tasks.

Speed up indexing

Exclude directories and file types

By default, CLion indexes all the directories listed in CMakeLists.txt (sources and include_directories paths) for the purpose of correct resolve.

Your project may contain folders with binaries, logs, or build artifacts, which do not affect CLion code insight. Also, indexing some folders can be too expensive due to their size or location. So it is reasonable to exclude such folders manually: right-click the directory in the project tree and select Mark Directory as | Excluded.

Mark directory as excluded

Since the symbols from the excluded files remain uncompleted for CLion, the following features are not available for such files: code completion and auto-import (except for the case when the excluded directory is marked with include_directories in CMakeLists.txt) , code generation, Find in Files (except for the scope of the currently opened files), navigation, and refactorings.

Another way to eliminate files like logs or generated data from indexing is to exclude them by file type in Settings | Editor | File Types:

Ignored files types

Work with smaller CMake subprojects

The scope of files being parsed is determined by the loaded CMake script. So if your project is split into several subdirectories with self-contained CMakeLists.txt in each of them, you can load smaller subprojects separately (for this, run Load CMake project on sub-CMakeLists.txt):

Load a CMake subproject

Another alternative for the case when you need to explore only a part of a big project is to create a compilation database, reduce it to the part of interest, and then open as a project in CLion.

Eliminate heavy parsing with the _CLION_IDE__ macro

IDE freezes may happen during the parsing of intricate preprocessor macros. To eliminate such problematic definitions from your code, replace them with some dummy ones using the __CLION_IDE__ (or __JETBRAINS_IDE__) macro:

CLion IDE macro

This macro affects parsing only, and it is undefined when you build or run your code.

Disable unnecessary plugins

To increase the IDE performance, try disabling the plugins you don't need. You will always be able to turn them on again later.

For example, if you are using a particular testing framework, consider disabling the plugins for other testing frameworks supported in CLion.

  1. Go to Settings | Plugins.

  2. Browse the Installed tab and disable the unnecessary plugins:

    Disabling an unnecessary plugin

    You can also disable all manually installed plugins at once (the non-bundled ones) from the menu under The Settings button:

    Disable all downloaded plugins

Report performance problems

If you experience an IDE freeze or high CPU/memory usage, and the tips listed above do not help, please provide us with the IDE logs, thread dumps, and snapshots. For more information about retrieving and sending them, refer to this instruction.

Last modified: 14 December 2024