24

I was reading this blog post about the experience of a team using Intellij Idea for large maven projects and have also looked at a similar question posted around 2 years back for IDEA v.10.0.2.

One of the tips mentioned in the former made a whole lot of sense :
Move C:\Users\$user\.IntelliJIdea12 into a folder not access-scanned by the antivirus.

I have searched around for performance centric VM options and currently my idea64.exe.vmoptions looks like this :

-Xms1200m
-Xmx1200m
-XX:MaxPermSize=200m
-ea
-server
-XX:+DoEscapeAnalysis
-XX:+UseCompressedOops
-XX:+UnlockExperimentalVMOptions
-XX:+UseParallelGC
-XX:ReservedCodeCacheSize=64m
-XX:+UseCodeCacheFlushing
-Dsun.io.useCanonCaches=false

Questions

  1. Do you have any more such tips to improve Intellij IDEA (12.1.3, 64 bit) performance with large/huge maven projects ?

  2. Could you please share discoveries you have made w.r.t VM options in idea64.exe.vmoptions and/or IDEA configuration in idea.properties.

  3. I have tried using JDK 7 to startup IDEA but this does not seem to terribly affect it's performance one way or the other. If you have tried doing so, did you experience the same ?

Community
  • 1
  • 1
Ashutosh Jindal
  • 18,501
  • 4
  • 62
  • 91
  • 4
    Do you have any specific performance problems? What exactly is slow? It's recommended to [follow this document](http://devnet.jetbrains.com/docs/DOC-192) and [report issues with CPU snapshots attached to YouTrack](http://youtrack.jetbrains.com/issues/IDEA) rather than tweak JVM options. The only option that is recommended to adjust is the heap size (only in case you get frequent GC or OOM errors). – CrazyCoder Jun 07 '13 at 10:06
  • I have a large maven project which causes IDEA to hang frequently or be sluggish. My system has 8gb of RAM and an SSD with 25/120 GB empty space. – Ashutosh Jindal Jun 07 '13 at 10:16
  • What do you mean by large? Can you give us some metrics? Class count, file count, module count, artifact count, etc? – Software Engineer Jun 09 '13 at 03:06
  • I'm working on a project at the moment that has a couple of hundred modules, about thirty or so webapps, and it uses about a thousand supporting jars adding up to a 500MB compiled and zipped distributable. Do you mean bigger than that? I set a 2gb heap and that's the only thing I really ever needed to play with. Of course, I'm using a top of the range MacBook Poo with a big SSD to hold the files and 16GB of ram, but still... – Software Engineer Jun 09 '13 at 03:10
  • @EngineerDollery Thanks for sharing the metrics. The project I am working on has about 230 sub-modules and has a compiled+zipped size of around 100 MB. 8K+ class count ; 400k+ LOC. – Ashutosh Jindal Jun 09 '13 at 06:50
  • Your project is quite large then, so sometimes you should expect some performance problems, but not many and not often. The most common problems occur when the ide's jvm is doing garbage collection. Have you tried loading up the system into intellij on your home machine? It may simply be the pc you're using. – Software Engineer Jun 09 '13 at 06:57
  • btw: what is slow? I can do a regex search across my whole codebase in less than 15 seconds on average, and around 30 at most. Building the system takes around a minute (although my tests are slow, taking up to 15 minutes on a server!). – Software Engineer Jun 09 '13 at 06:58
  • @CrazyCoder, thanks for sharing that link. I think moving the .Intellij12 folder to a folder excluded by AV on-access-scanner has made an appreciable difference. – Ashutosh Jindal Jun 09 '13 at 07:12
  • @EngineerDollery, Switching back and forth between IntelliJ and other applications is slow (need more RAM ?). IntelliJ just seems to hang for a while. Also, sometimes it becomes un-responsive altogether when re-importing/syncing changes in pom.xml files. – Ashutosh Jindal Jun 09 '13 at 07:16
  • @EngineerDollery, could you please check whether you have ThreadDumps being created ? According to ['Automatic Thread Dumps Logging'](http://devnet.jetbrains.com/docs/DOC-192), if the UI becomes unresponsive for more than 5 seconds, the ThreadDumps are created. I can confirm that I have loads of these logs. It would be interesting to see how a higher-spec MBP fares. – Ashutosh Jindal Jun 09 '13 at 07:53

3 Answers3

27

As suggested by @CrazyCoder, I followed the steps on the official FAQ regarding this matter:

Common solutions for IntellJ IDEA performance problems

Specifically, the following seemed to have had an appreciable affect:

  1. Moved the c:/Users/$user/.IntelliJIdea12 to a location excluded by McAfee's on-access-scanner, and updated $INTELLJ_INSTALL_FOLDER/bin/idea.properties to point to the new location like so (where c:/dev is the folder excluded by McAfee):

    idea.config.path=c:/dev/.IntelliJIdea12/config
    idea.system.path=c:/dev/.IntelliJIdea12/system
    idea.plugins.path=c:/dev/.IntelliJIdea12/config/plugins
    idea.log.path=c:/dev/.IntelliJIdea12/system/log

  2. In $INTELLJ_INSTALL_FOLDER/bin/idea.properties set idea.jars.nocopy=true as documented in this blog post.

  3. Reverted back to the stock $INTELLIJ_INSTALL_FOLDER/bin/idea64.exe.vmoptions. The only changes that remains are those suggested in Too low heap size for a 64-bit JVM. Here is what I have in the that file currently:

    -Xms1200m
    -Xmx1200m
    -XX:+UseCompressedOops
    -XX:MaxPermSize=350m
    -XX:ReservedCodeCacheSize=96m
    -XX:+UseCodeCacheFlushing
    -ea
    -Dsun.io.useCanonCaches=false
    -Djava.net.preferIPv4Stack=true

  4. Disabled Git integration plugin since I mostly use command line Cygwin-Git.

  5. It was useful to monitor .IntelliJIdea12/idea.log. For example : I disabled the osmorc (for OSGI) plugin after seeing that it was frequently logging error while trying to opening zip files in the projects. Sample error :

    WARN - pi.vfs.impl.jar.JarHandlerBase - error in opening zip file: C:\dev\a-maven-project\pom.xml java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.(ZipFile.java:127)
    at java.util.zip.ZipFile.(ZipFile.java:143)

  6. Disabled all the plugins that I do not need. The current list of disabled plugins is :

    Disabled plugins: ASP (0.1), Android Designer, Android Support (10.0), Atlassian Connector for IntelliJ IDE (3.0.9, SVN:1212171008), Base Cucumber (1.0), BashSupport (1.1beta16), CFML Support (3.53), CheckStyle-IDEA (4.2), ClearCase Integration (2.0), Cloud Foundry integration (1.0), CloudBees integration (1.0), Commander (1.0.0), Copy as HTML (0.8.1), Cucumber for Groovy (1.0), Cucumber for Java (1.0), Database Navigator (3.0.2501), Describe Key (0.3), Drools Support (1.0), Eclipse Integration (3.0), Flash/Flex Support (1.0), GWT Support (1.0), Geronimo Integration (1.0), Git Integration (8.1), GitHub, Google App Engine Integration (1.1.4), Grep Console (1.1), GuiceyIDEA (8.0), HAML, IDEtalk (1.0), IdeaVim (0.28), Identifier Highlighter (3.62), IntelliJad Plus (0.5.6), JBoss Integration (1.0), JBoss jBPM (2.0.0), JRebel Plugin (2.0.2), JavaFX (1.0), Key promoter (1.0.11), Log4JPlugin (1.02), Markdown (0.8.3), Osmorc (1.4.3), Perforce Integration (2.0), PluginUpdateNotifier (2.0.3), RemoteTail (0.3.4), Resin Integration (8.1), Ruby (5.4.0.20130410), SQL Query Plugin (2.2), SSH Remote Run (0.1), Seam Pageflow Support (1.0), Seam Pages Support (1.0), Seam Support (1.0), SmarterEditor (0.8.3), Struts Navigator Plugin (1.3.4), Subversion Integration (1.1), TFS Integration (999.999), Tapestry support (1.0), TestNG-J (8.0), UI Designer, UI Designer (Core), Vaadin Support (1.0), Visual SourceSafe Integration (2.0), WebLogic Integration (1.0), WebSphere Integration (1.0), ZKM-Unscramble (1.0), dmServer Support (0.9.5), hg4idea (10.0), soapUI Plugin (3.5)

Ashutosh Jindal
  • 18,501
  • 4
  • 62
  • 91
5

IntelliJ IDEA 2017.2 Added really nice feature, which helps a lot when working with large projects. Basically, you can mark which modules will be loaded by IDEA and which not. Unloaded modules will not be touched in any way by the IDE. They will not be indexed, searched, they will not be subject to refactoring on inspections. Loaded/Unloaded modules can be quickly configured in Load/Unload Modules dialog. The dialog can be opened using

Project Tree window → Right Click on a file → Load/Unload Modules...

enter image description here Temporarily reducing the number of modules IDEA works with will greatly increase the performance for big projects. You can find more info about this feature and other performance tweaks for IntelliJ IDEA in a blog post I wrote: IntelliJ IDEA Tips & Tricks: Improving performance

Vojtech Ruzicka
  • 16,384
  • 15
  • 63
  • 66
4

Sometimes you can run out of memory on a large project. An import process of the large maven project fails then.
So if any of modules of your project is underlined with a red line and you see

Exception java.lang.OutOfMemoryError: GC overhead limit exceeded

on it, go to "Settings -> Build Tools -> Maven -> Importing", and find the "VM options for importer" option there. Increase the limit, set it to -Xmx1g (or more).

(Source)

Community
  • 1
  • 1
naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259