logo

How to Speed Up IntelliJ IDEA / Clion

Last Updated: 2022-08-06

Disable all unnecessary plugins

To disable plugins, open menu File > Settings > Plugins. Safe candidates for disabling are version control plugins (CVS, Git, Mercurial, Perforce, Subversion, TFS) that you don't use.

Edit VM Options

Click Help > Edit Custom VM Options…

Or activate the action menu with Control + Shift + A. Type vmoptions and select Edit Custom VM Options

(Clion VM Options are stored in ~/.Clion*/config/clion64.vmoptions)

Note: Don't edit .vmoptions and .properties files directly on macOS, as it will violate the application signature.

Set Memory

-Xss2m
-Xms16g
-Xmx31g

Why 31 GB but not larger: because anything larger disables pointer compression optimization, pointer-heavy applications effectively have less usable memory.

Read more: https://blog.codecentric.de/en/2014/02/35gb-heap-less-32gb-java-jvm-memory-oddities/

To check your memory:

$ lshw -class memory

Try a new Java garbage collector

Use G1:

-XX:+UseG1GC
-XX:MaxGCPauseMillis=200

Use ShenandoahGC:

-XX:+UseShenandoahGC

Remember to delete the line that uses the concurrent marksweep GC

Put ephemeral files in tmpfs (RAM)

Activate the action menu with Control + Shift + A Type edit custom properties and select Edit Custom Properties

Or create or edit ~/.CLion*/config/idea.properties and set idea.system.path to any writable tmpfs, e.g. /dev/shm:

idea.system.path=/dev/shm/CLion/system

Note:

  • you need to completely reindex every time you restart the IDE
  • your logs are also in memory, so if you have other issues they'll be harder to diagnose

To create a ramdisk:

$ mkdir -p /mnt/ram
$ mount -t tmpfs tmpfs /mnt/ram -o size=8192M

Use an SSD

If you can change your hardware. This is the most effective way to speed up the IDE.

To check

$ lsblk -d -o name,rota
NAME    ROTA
nvme0n1    0

If the ROTA column shows 1, you don't have an SSD