11

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.

Hoàng Long
  • 10,746
  • 20
  • 75
  • 124
  • 1
    Why do you have large text files like that, anyway? Is it source code that could be refactored into many smaller files? (General questions; it's unlikely your IO would improve unless you bought an SSD.) – Makoto Nov 20 '14 at 04:56
  • Sublime Text 2 or 3 is what you should be using. –  Nov 20 '14 at 05:04
  • @Makoto: sorry I have been out a little. Yes source code can be refactored, but it would take a long time and high risk. We have a big project coming to deadline so I would prefer an easier solution – Hoàng Long Nov 20 '14 at 06:07
  • @Sajidkhan: no, it's not a duplicate. From what I can tell the problem is specific to text editing very large files. Other tasks run fine on my IDE – Hoàng Long Nov 20 '14 at 06:09
  • @JarrodRoberson: might be, but can you point me some way to quickly edit from IntelliJ? I need some way to deal with the problem of large files, but if that mean I need to copy the file back and forth between IntelliJ and other IDE, it would be less desirable. – Hoàng Long Nov 20 '14 at 06:11
  • Somehow when I run jps -v, the result of memory used is not what I config: -Didea.platform.prefix=Studio -Xms3072m -Xmx4096m -XX:MaxPermSize=3584m . I wonder is it a limit of IntelliJ? – Hoàng Long Nov 27 '14 at 11:17

3 Answers3

13

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.

Hoàng Long
  • 10,746
  • 20
  • 75
  • 124
  • 1
    This worked for me as well, which was expected. Syntax highlighting a file with 18k lines is just not possible (and I curse the guy who created this file).... – fgblomqvist Aug 04 '15 at 14:56
  • also, they should've detected somehow and skipped highlighting minified and uglified files.. – the Hutt May 30 '22 at 09:12
4

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!

happyvirus
  • 279
  • 3
  • 21
  • 2
    and be sure to run the 64 bit start script/executable or this will have no effect! –  Nov 20 '14 at 05:03
  • 1
    @Sajidkhan: sorry I couldn't be here all time. I have to check if there's any other thing I overlook. – Hoàng Long Nov 20 '14 at 06:48
  • I think I edit the file already, but I will go and check the start script – Hoàng Long Nov 20 '14 at 06:49
  • This is my current configuration, I think they are all pretty high: -Xms512m -Xmx2048m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=96m -XX:+UseCodeCacheFlushing -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true – Hoàng Long Nov 20 '14 at 06:57
  • Try changing it to: -Xms128m -Xmx8192m -XX:MaxPermSize=1024m don't forget to restart – happyvirus Nov 20 '14 at 06:59
  • @Sajidkhan: sorry, I didn't notice there was an answer 2 hours ago. Must be some issue with my eyes... I believe I only see the comments (no answer just a while before) – Hoàng Long Nov 20 '14 at 06:59
  • Somehow the memory allocated doesn't change. I'm investigating the issue – Hoàng Long Nov 20 '14 at 07:14
2

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.

DoctorP
  • 159
  • 2
  • 10
  • IMHO, this is not an IDE bug. The problem is in using large source files. Anyway, they are much more complex to test and maintain, so it is always better to split them if possible. – Serge Ballesta Feb 11 '17 at 17:32
  • thanks for the effort. As shown above, it is (most likely) due to syntax highlighting. Turning off syntax highlighting (treat them as normal text file) will help. – Hoàng Long Feb 13 '17 at 02:14
  • @SergeBallesta: I wish it could be possible at that time. Though sometimes we don't have a choice (like having a long i18n file) – Hoàng Long Feb 13 '17 at 02:17
  • 1
    @Serge Ballesta yes I agree with you but sometimes you have to deal with such code. – DoctorP Feb 13 '17 at 10:14
  • 1
    @Hoàng Long Turning off syntax highlighting helps but not much – DoctorP Feb 13 '17 at 10:15
  • Another suggestion. Don't run 64bit version (your project should be very large for this). 32bit version works faster and eats less memory. Hope all this will help. – DoctorP Mar 04 '17 at 13:03