Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ is very slow when handling big files

I'm using Guidewire development Studio (IntelliJ-based IDE), and it is very slow when handling big text files (~ 1500 lines and above). I tried with an out-of-the-box community IntelliJ as well, but meet the same problem.

When I open those files, it takes 1 second to type a character, even when I see clearly that the used memory is still plenty (1441 MB/ 3959 MB). Also, it quickly suck up all the memory if I open multiple files (I allocate 4GB just for IntelliJ). Intellisense and other automatical stuff is painfully slow as well.

I love IntelliJ, but working in those condition is just so hard. Is there any way to work around this problem? I have thought of some alternatives, like:

  1. Edit big files on another editor (eg: Notepad++), then reload it on IntelliJ
  2. Open another small file, copy your bit of code there, edit it, then copy it back. It would help because intellisense and code highlight is maintained, however it is troublesome

I did turn off all unnecessary plugins, only leaving those necessary, but nothing improved much.

I am also wondering if I can "embed" some of outside editor in IntelliJ? Like Notepad++, Notepad2 for example? I did my homework and google around but find no plugins/ configuration that allow to do that.

Is there anyone who's experienced can give me some advices how to work with big files in IntelliJ (without going mad)?

UPDATE: Through my research I learn that IntelliJ can break for very large files (like 20mb) or so on. But my file isn't that big. It just have about 100KB - 1MB, but it's very long text.

UPDATE 2 After trying increase the heap memory as Sajidkhan advise (I changed both idea64.vmoptions and idea.vmoptions), I realize that somehow IntelliJ doesn't take the change. The memory heap is stuck at maximum 3GB.

On another note, the slow performance can be perceived when the system uses only around ~1GB of heap memory, so I think the problem doesn't relate to memory issue.

like image 820
Hoàng Long Avatar asked Nov 20 '14 04:11

Hoàng Long


People also ask

Why IntelliJ is very slow?

Increase memory for IntelliJ IDEA By default, the IDE requests a maximum of 2048 MB. You can change this option in Help → Change memory settings. According to the feedback from some of our users and colleagues with big projects, changing the option to 8GB significantly improves IDE performance.

How can I make IntelliJ Ultimate faster?

Unloading unused modules Working on a large multi-module project can affect performance since IDEA needs to process a large amount of files for search, inspections, refactoring code and similar operations. If you do not need all the modules at the same time it is advisable to exclude them from the IDEA's activity.

How do I fix my IntelliJ idea?

From the main menu, select File | Repair IDE. IntelliJ IDEA will automatically launch the first recovery step and refresh the virtual file system. IntelliJ IDEA will display a notification that you can use to continue or complete the recovery process.


3 Answers

After a while working around the bush, I find a workaround, kind of.

When I check other answers from similar questions, I found that they begin get troubles when the file size is at least several MBs. It doesn't make sense, since I got the trouble when the files are only several KBs. After more careful checking, I found that the Gosu plugin is the culprit: after I mark my Gosu file as "text only", the speed becomes normal.

So I guess the problem has something to do with code highlighter & syntax reminder. For now, the best way I work-around this is:

  1. Right-click the file and mark it as plain text.
  2. Close the file and open it again, then edit.

Note: Since it applies for all the file type in Guidewire development suit, you may want to mark permanently some long files as plain text, especially the *.properties (aka, i18n/international files). The benefit of code auto-completer just doesn't worth the trouble.

like image 148
Hoàng Long Avatar answered Oct 19 '22 13:10

Hoàng Long


Can you try editing idea64.vmoptions in the bin folder. You could set the max heap and max PermGen to be a higher value

Don't forget to restart!

like image 26
happyvirus Avatar answered Oct 19 '22 11:10

happyvirus


Tested on different PCs. Even on fast processors the editor is painfully slow when working with large files (2000+ lines of code).

Eclipse, Netbeans are absolutely OK. Tuning .vmoptions will not help.

This bug is still not fixed: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206999515-PhpStorm-extremely-slow-on-large-source-files

UPDATE. Try 32 bit version with default settings. Usually 32bit idea works faster and eats less memory.

like image 35
DoctorP Avatar answered Oct 19 '22 12:10

DoctorP