Ok, I know that most people say "java isn't slow these days, it just has a slow startup phase" but nobody can look me in the eye and tell me that using netbeans or eclipse or jedit is as responsive as say, visual studio or textmate, even after running for hours of "warmup" time. Oh, startup time is definitely a problem (cough eclipse) I'll admit, but I'm talking general responsiveness here. Jedit has a small noticeable lag when you resize windows, for example.
A reasonable apples to apples comparison would, I think, be jedit (or any java based text editor) versus TextMate, SciTE.
The question it really boils down to is "if netbeans/eclipse were rewritten entirely in C, with the same feature set, would you expect it to have the same performance characteristics as it currently does."
Any ideas?
And a few observations:
This simple swing-based editor [1] has very odd lags when you resize the window, but scrolling feels quite responsive. Also, with netbeans, when you start resizing, until you "stop" resizing the window it draws an ugly black background [4]. Perhaps swing refuses to do any refreshes while the window is being dragged?
Here is an simple swt simple text editor [2]. It is quite responsive to both dragging and scrolling.
Here is another simple (jface) swt editor [3]. It resizes so poorly I think it must be a bad fluke. I hope.
I've also noticed that notepad and visual studio tend to have show temporary white "blips" when they refresh (ex: when using page down through a very long document). swt and swing apps don't seem to ever have those extra white blips, so I'm wondering if they have some extra internal buffering or something. This could cause a small slowdown, perception wise
[5] is a related, but not quite the same, question.
My current guesses, based a little on the existing answers/comments:
- Netbeans has just become bloated. Maybe there's something about editing java that makes editor creators go overboard? Maybe they don't optimize their editors for some reason?
- Java editors use tons of RAM maybe that keeps things out of L2 cache?
- Java editors edit java, so maybe they have to keep constantly calling out to, say, javac, which incurs the slow startup penalty over and over again each time?
- SWT is an abstraction layer over native widgets, which maybe slow things down.
- Swing has an awful resize refresh policy, which makes it "appear" slow.
- Netbeans uses the client VM, so maybe it just isn't tuned for speed? (see also [6] which contains a link to another question with an answer that is a slew of parameters you can pass to netbeans to try and speed it up).
- Swing/SWT appear to have fewer artifacts during scrolling than native windows apps. Perhaps this means they have buffering "helpers" to help avoid artifacts, causing perceived slowness since it doesn't refresh immediately.
- Perhaps Java has no megalithic benchmarks, so maybe it is not optimized for that type of loads? Maybe there is some hidden inefficiencies.
- Relatedly, maybe java can be "made to be" fast, but somehow the editor creators aren't using it efficiently ("the core library will save me speed-wise!").
- Maybe it just "feels" slow since (at least netbeans) has to constantly call out to new java instances to run debuggers, etc., which each take their own slow startup time hit.
Thanks! -roger-
[2] https://gist.github.com/972234
[3] http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/BasicEditor.htm compile/run it like java -cp .;swt\win32.jar;jface/* BasicEditor
[6] is there a way to make netbeans use the hotspot server vm