I\'m using intelliJ for Scala development and got 8 GB of new RAM last week, so I thought: time to use it. I checked my task manager and found intelliJ using ~2
The answer provided by adben
is very helpful for improving the performance in my machine. Though I slightly overrided it after reading a Dzone article,
-server
-Xms2g
-Xmx2g
-XX:NewRatio=3
-Xss16m
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled
-XX:ConcGCThreads=4
-XX:ReservedCodeCacheSize=240m
-XX:+AlwaysPreTouch
-XX:+TieredCompilation
-XX:+UseCompressedOops
-XX:SoftRefLRUPolicyMSPerMB=50
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djsse.enableSNIExtension=false
-ea
They improved the performance of large projects by using the above configuration and works flawlessly for our projects too. Lastly, I disabled all the plugins I won't use and that improves the things as well.
Reference: https://dzone.com/articles/the-one-and-only-reason-to-customize-intellij-idea
I've done some experimenting, and found that to decrease GC pauses the following combination works best: -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50
.
I'd also not make the heap too large, 512 or even smaller is OK for me. Otherwise when it becomes full the GC will have to walk it all which takes some time.
I used this combination and it's working fine in my environment
-server
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
-XX:SurvivorRatio=8
-XX:+UseCodeCacheFlushing
-XX:+UseConcMarkSweepGC
-XX:+AggressiveOpts
-XX:+CMSClassUnloadingEnabled
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-XX:+CMSParallelRemarkEnabled
-XX:CMSInitiatingOccupancyFraction=65
-XX:+CMSScavengeBeforeRemark
-XX:+UseCMSInitiatingOccupancyOnly
-XX:ReservedCodeCacheSize=64m
-XX:-TraceClassUnloading
-ea
-Dsun.io.useCanonCaches=false
You can use the intellij's optimizer plugin:
https://zeroturnaround.com/free/optimizer-for-intellij-idea/
With the plugin you can:
For me switching to SSD-drive improved performance a lot (especially for large projects).
The most useful thing you can do for IntelliJ is to have a lot of free memory for disk caching. IntelliJ saves alot of its processing work in cached files. This works well if you have plenty of free memory, but if your disk cache is limited, you will see regular, long lasting pauses.
I would suggest -XX:+UseConcMarkSweepGC
rather than G1
.
I also work local copies of files to minimise file access delay.
BTW: For the project I am on, I noticed the difference between working on a machine with 24 GB and one with 48 GB, even though the max heap is set to 2 GB ;)