Making IntelliJ IDEA Run Faster and Better
I took the time to listen to the, about one hour long, IntelliJ IDEA Architecture and Performance video, by Dmitry Jemerov from Jetbrains. Most of the beginning of the video was not very intesting for me, but 37 minutes into the video, the good stuff comes Here is a little extract, of some main points of Dmitry, on how to make IDEA run faster:
A tool like IDEA is naturally heavily IO-bound, in that it needs to keep track of very large amounts of files. Not surprisingly, you can achieve better performance, if you can make IDEA do less IO or optimize the IO, that it does perform:
- Apparently, they (Jetbrains) has done experiments and measurements, that shows 10,000 RPM drives to show better performance in IDEA. If they say so, I have no reason to doubt it. I would not have chosen that, as my first experiment myself.
- Avoid storing source, IDEA caches or any other files related to IDEA, on network drives. That one is quite obvious, I think.
Then, there are some more specific issues on IO, which are more or less related directly to Windows users. These tips can remove signifant overhead on each file access:
- Disable antivirus scanning on (IDEA) system directory. I have heard this one before, as a more general advice, to optimize performance on Java desktop applications on Windows. Most (if not all?) antivirus software, scan jar files too. Dmitry mentioned, that a file close operation, which should take near to no time, can take up to half a second, with some antivirus software. Auch!
- Regularly run disk defrag. Oh, how I just hate NTFS “performance”. Currently, my laptop drive is near full, and system performance degrades like hell. And defrag is hardly possible, when nearly no space is left
- Turn off Windows System Restore. I did this, and as a side-effect, I also got 4,5GB of diskspace back. Space, that windows system restore had taken. “Nice”. Of course, there is an clear down-side of this, as you are not able to restore windows from a previous sync point. But then again, I have never had that need. It isn’t that I haven’t had windows fuck up my disk, I just have never had any chance to use this restore shit when it happened.
JVM Based Optimizations
- Use JDK6: There are plenty of performance improvements from Sun, that helps IDEA.
- Setting -Xmx (max heap), but “reasonably sized projects”, like the source to IDEA itself, does not need more than 300-500 megs. So do not set it too large.
- One exception though: If you feel like running IDEA with -server, then -Xmx1G or more should let IDEA’s caches live longer (due to soft-references living longer with large mem available in -server mode). My note: Be sure you have the physical RAM available!
- If you are on a multi-core machine, enabling parallel garbage collection can help (reduces gc pauses). Note: Some have stability issues with this.
IDE Related Stuff
Here are some stuff, which have to do with settings or the like on the IDE itself, which can help it perform better:
- Use latest version. Well, dugh! Of course they are gonna say that. I am sure there is some truth in it, but new features also take out some performance. Take an old IDEA 4 and run it on todays hardware, and I bet you will see great performance. But who would wanna do that.
- Disable unused plugins (like the commander? It must be mostly load-time that will benefit here?
- Exclude unneeded folders. Actually, this one could have been listed under the IO-related bullets too, as it is to reduce IO/file surveillance. An example is to exclude build-generated stuff. My note: More often than not, your source depends on the generated stuff, so no good idea excluding it.
- Set version control to “None” for generated code.
- Do not disable “Synchronize files on frame activation” (since 6.0.2). Supposedly, they have done something great, for this file synch to not be a (big) problem anymore.
- Use “Project” mode in the “Project view”, as the “Package” mode is slower. A bit of a surprise to me, but they actually know, that they have a performance problem when using “Package” mode. No problem for me, as I am nearly always using the “Project” mode anyway.
- Disable expensive inspections: Some of the inspections IDEA performs are supposedly heavy. Sadly, there is no advice on which to disable, so…
- Disable framework-specific validation (JPA, spring, …) on Make: I have done this myself sometimes, but mostly due to validation errors that were actually wrong, and was wrongly failing my build. But it does perform faster builds without. Also, not that big a problem, as I mostly build from outside IDEA, using maven.
- Do not use method breakpoints: Apparently, you can experience slow debugging if you use method breakpoints. This is said to be a JDK issue.
This was the complete list of advice on upping the performance of IntelliJ IDEA as Dmitry said it.
Q and A
Then came the Q and A part of the presentation. Here are some of the interesting ones related to performance:
- Q: Synchronizing a lot of changes from disk pegs one cpu/core. How come?
- A: This operation is not parallelized (…yet, it will be in v8 with the new indexing framework)
- Q: Restart required on plugin install. How come?
- A: Blah blah, plugin might not work otherwise. Blah blah. We might make this better in v8. Blah.
A Bit About Version 8
Apart from the performance stuff, there were some bits of information on the upcoming version 8 in the video. Many of the things they are building seem to emphasize language indendency, as in, they are general operations or frameworks, that can support all languages. This includes the new indexing framework. I guess this is due to plans on supporting much more languages in their IDE, and I think I heard Python mentioned (but okay, the talk was at google, so…
That were the highlights as I heard them, but go see/hear the video yourself, if you want the details.