0

I have an old project, whose size is 225Mb, where most classes have the whole body commented. In the past I did not use versioning of code in my company and the versioning was done in the code itself, commenting on a line and writing the change in the line below. Example:

==> 2019-07-09 the code was:

System.out.println ("Hello World 1");


==> 2019-07-10 the code was:       

//System.out.println("Hello World 1");    
System.out.println ("Hello World 2");

==> 2019-07-11 the code was:       

//System.out.println("Hello World 1");    
//System.out.println ("Hello World 2");
System.out.println ("Hello World 3");

Now imagine this for more than 2000 classes, where there are several large blocks of commented code.

Can all of these classes cause slowness in eclipse?

I ask because when I open this project the eclipse is very slow.

  • 1
    Interesting, you might need to increase memory on eclipse.ini `-Xms256m -Xmx1024m` to higher values. – LMC Jul 11 '19 at 20:54
  • 1
    When a project is opened, all `.java` files will be read and compiled. Larger files due to comments does not require more memory, but reading more bytes takes of course longer. Where is the project located? On a hard disc (which gets slower and slower as it gets fuller), shared network drive (which is slow because of the network) or on a SSD (the best choice)? The slowdown could also be caused by additional plug-ins or by anti-virus software. – howlger Jul 12 '19 at 08:26
  • @LuisMuñoz Uncommented code is skipped by the parser. How could more memory help here? – howlger Jul 12 '19 at 08:28
  • Hi guys! Thanks for the answers. I had already changed the memory to -Xms256m -Xmx1024m in eclipse.ini. The project is in my local HD. I use MacOS, but the slowness is in any OS. Will the size of .java files be the cause? I have extremely large classes in this project. – Igor Moisés Jul 12 '19 at 11:56
  • @howlger Eclipse needs also to run the indexer. There are [OOM reports](https://stackoverflow.com/questions/8721259/why-i-am-getting-outofmemory-exception-in-eclipse) so it can be a cause of slowness. [Here's more info](https://wiki.eclipse.org/JDT_Core_Index_Programmer_Guide#General_Info) on the indexer and here's a tip on how to [pre-built indexes](http://eclipseandjazz.blogspot.com/2012/01/faster-java-search-using-pre-built.html). – LMC Jul 12 '19 at 13:41
  • @LuisMuñoz Undocumented code does not affect the size of the Java index. You are referring to an OOM bug that has been fixed for many, many years. – howlger Jul 12 '19 at 14:08
  • @howlger yet the indexer needs to parse the whole file to know what to put in the index. I mentioned the OOM because indexing is an area of stress in eclipse so it could cause also excessive gc activity. – LMC Jul 12 '19 at 14:12
  • @IgorMoisés The size of the Java files are probably not the cause. In the past there were performance problems when having a lot of deeply nested packages, but these have been fixed. Are you using the current Eclipse 2019-06 IDE? Do you have the Java or Java EE package? Is this a simple Java project (or does the project have additional natures, e.g. web, Maven, etc.)? Which additional plug-ins do you have? – howlger Jul 12 '19 at 14:19
  • @LuisMuñoz Which bug exactly are you talking about? – howlger Jul 12 '19 at 14:24
  • @howlger I didn't mentioned a bug :). Eclipse OOM might be caused not only by a bug. – LMC Jul 12 '19 at 14:45
  • 1
    @LuisMuñoz If you can reproduce an OOM by the Java indexer in the current Eclipse IDE 2019-06, please [report it to Eclipse JDT as a bug here](https://bugs.eclipse.org/bugs/). – howlger Jul 12 '19 at 16:33
  • Is this a simple Java projects and i have seven tomcat projects. We are working on tomcat-plug-in version 9. This condition is general. My team have five persons and all have a problem. – Igor Moisés Jul 12 '19 at 18:08
  • @IgorMoisés To answer your question: comments certainly don't make Eclipse slow. You can convince yourself of this by creating two projects, one with uncommented code and another with whitespace instead (so that the file length is identical). In my experience, the most common reason for a slow Eclipse are third-party plugins that have been installed in addition. Also, an outdated Eclipse version might be the cause. But unfortunately, without you answering the question from my last comment, it's just blind guessing. – howlger Jul 13 '19 at 10:13
  • @howger sorry ! I'm using Neon.3 Release (4.6.3). JavaEE package and as I said before I use the tomcat plugin. – Igor Moisés Jul 16 '19 at 11:33
  • @IgorMoisés Your Eclipse is pretty outdated, you are more than two years and six releases behind. Can you reproduce the issue with Eclipse 2019-06 (4.12) with and without the Tomcat plug-in? – howlger Jul 18 '19 at 06:58

0 Answers0