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:
Thanks! -roger-
[1] http://www.picksourcecode.com/articles/explan.php?id=6c9882bbac1c7093bd25041881277658&ems=9a0fa83125d48ab7258eab27754dd23e&lg=10
[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
[4] http://twitpic.com/4xi8ov
[5] Is Java really slow?
[6] is there a way to make netbeans use the hotspot server vm
To do all of that "on the fly" code syntax checking and highlighting, you basically have to write your editor to understand (that means lex, parse, type check, syntax verify, etc) the java language and verify the contents of the text editor during every intermediate state between you starting off with a nearly empty class and finishing your program.
Also for cross reference integrity, you have to hold enough information about all the other classes in memory so you can really make sure that when you call a method on an object, it really exists on that "other" object.
That's not to mention all of the other places where items are indexed, etc.
In short, it's slow because it's doing a lot, even if all of the stuff it is doing isn't immediately appreciated by a person who is only concerned with the letters on the screen (and not all the features of the IDE).
This doesn't directly answer your question but here's some more info regarding window toolkit benchmarks
It is hard to give a rule-of-thumb where SWT would outperform Swing, or vice versa. In some environments (e.g., Windows), SWT is a winner. In others (Linux, VMware hosting Windows), Swing and its redraw optimization outperform SWT significantly. Differences in performance are significant: factors of 2 and more are common, in either direction. Code written in C/C++ using the X library performs somewhat faster than code written in Java using SWT, with the speed-up being from 5% to 10%
Source http://pub.cosylab.com/CSS/DOC-SWT_Vs._Swing_Performance_Comparison.pdf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With