13

I am working on a fairly large project and have recently bumped into the good old friend of mine from the 90's, typing lag. My setup is MacBook Pro 2.2 GHz i7 8GB with SSD drive and it hasn't had any serious performance issues so far.

I have increased the memory allocations to -Xmx1024m and -XX:MaxPermSize=512m. There is no heavy use of plugins involved. Also, this only happens on .java files in the default editor.

What could be the problem?

EDIT:
I found the problem. I noticed that the problem occurred only when editing large java files. In my case the class had 1800 rows.

It's weird though, since I am not facing the same problem with the same eclipse setup on Ubuntu. It seems like Eclipse on Mac just can't handle java files that big I was editing.

Any suggestions?

EDIT2:

I am using the Eclipse Indigo for Java EE with the latest updates (3.7.1.X)

Installed plugins:

  • m2eclipse
  • MercurialEclipse aka HGE (1.9.1 from the official eclipse update site)
  • Subclipse (installed, but not used in the workspace where the typing lag occurs)
  • ADT (installed, but not used in this project)

All plugins are installed via Eclipse marketplace and are updated to the latest release unless stated otherwise.

Kimi
  • 6,239
  • 5
  • 32
  • 49
  • 1
    Do you have either "Show whitespace characters" or "Show Line Numbers" enabled? I've seen a couple of reports of this behavior on Lion (but not earlier versions of OS X), for example https://bugs.eclipse.org/bugs/show_bug.cgi?id=366473 – E-Riz Jan 30 '12 at 15:00
  • I had line numbers enabled. Disabling them didn't help. Thanks though! – Kimi Jan 30 '12 at 15:07
  • I've had the same experience. Eclipse is also exceptionally sluggish once you have a lot of editor tabs open. The good news is that it keeps getting better every release. – Edward Thomson Jan 31 '12 at 15:03
  • @EdwardThomson You're right that having many editor tabs open may slow down Eclipse. However, in my case the amount of open tabs does not correlate with the sluggishness. It's exactly as bad as it is whether I have only that tab or 50 tabs open - and with 50 tabs open the smaller files aren't affected by the typing lag. – Kimi Jan 31 '12 at 15:23
  • @Kimi: Ah, yes, sorry, mine was an independent complaint. :) – Edward Thomson Jan 31 '12 at 15:59
  • Out of curiosity, are you using Carbon or Cocoa? 32 or 64 bit? I've noticed that - surprisingly - 32 bit Cocoa is a bit faster than 64 (at least on Snow Leopard). – Edward Thomson Jan 31 '12 at 16:00
  • Pardon me, but what do you mean? I'm developing Java software, not Objective-C stuff. The Java I'm using is the OS X built-in 64-bit JVM framework which is provided by Sun. Also, your previous complaint was perfectly valid :) – Kimi Jan 31 '12 at 16:07
  • @Kimi: for Eclipse 3.7, you can download versions that include SWT native libraries that target Carbon, 32-bit Cocoa or 64-bit Cocoa. You need to go to the "all downloads" page, with the complete list of platforms to see that. – Edward Thomson Feb 01 '12 at 15:07
  • Eclipse has a setting for disabling certain laggy features on large files (sorry, don't have one at hand to point out the menu path) – Alexander Pavlov Feb 03 '12 at 22:23
  • so what do we do Kimi? you've found any solutions yet? – Bastardo Feb 07 '12 at 20:28
  • @RoboLover Actually, yes. I managed to find good values for eclipse.ini configuration file. Answered my own question. – Kimi Feb 08 '12 at 07:01

2 Answers2

1

Try altering the settings in your eclipse.ini file. This contain the settings for the JVM and can help reduce memory issues like this.

Example eclipse.ini:

-data
../../workspace
-showlocation
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
384m
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-vm
../../../../program files/Java/jdk1.6.0_17/jre/bin/client/jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseConcMarkSweepGC
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-Dcom.sun.management.jmxremote
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=C:/jv/eclipse/mydropins

Detailed in this question and this question.

Community
  • 1
  • 1
Jivings
  • 22,834
  • 6
  • 60
  • 101
  • I modified the Windows specific parts to OS X equivalents, but it made no difference. Though, you were right about the problem being in the eclipse.ini file. – Kimi Feb 08 '12 at 07:19
0

Jivings was right about the root of the problem being in the eclipse.ini file.

I am not sure what I have actually changed in the eclipse.ini after messing around with the it, since the TimeMachine does not seem to be able to save a backup of the .ini file inside the Eclipse application package (Eclipse/Contents/MacOS/eclipse.ini).

I actually lowered the MaxPermSize and other memory values which made Eclipse run smoother. If anyone else is encountering the same problem, I suggest you try similar values and see if that works. If it doesn't, I also read that you can start eclipse once with the -clean argument, which cleans up some installation and usage history among other things. I did not do that, but it's worth a try.

The following is my current configuration, and it works pretty well:

-startup
../../../plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-XX:MaxPermSize=256m
-Xms40m
-Xmx512m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
Community
  • 1
  • 1
Kimi
  • 6,239
  • 5
  • 32
  • 49