Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

A bit concerned about the performance of SWT statements  RSS feed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a bit concerned about the statements being made that SWT performs better than Swing. I can imagine that initial load time may be a bit faster, but once the widgets are drawn, is there really that much of a difference? There seems to be a community wide misconception that Swing is slow and I don't buy it. If you thread your app correctly, it can function very quickly. And with some of the improvements of Java 1.5 things seem to move a bit quicker.

Does your book discuss much on the performance issue and give any benchmarks or details?
 
Rob Warner
author
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The book doesn't present any empirical evidence on Swing vs. SWT. It mentions Swing in Chapter 1, where it discusses Java GUI evolution, but that's as far as it goes.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have any personal knowledge of the difference in performance you could share with us?
 
Rob Warner
author
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My experience is that many Swing apps feel sluggish. I often hear people say that if the app were written correctly, threaded correctly, etc., that's not the case, but maybe that demonstrates that Swing apps require more code complexity to be responsive.

Native widgets respond like native widgets, however you write your code. Certainly, you can write an unresponsive SWT app by starving the UI, but it takes some work and foresight to do that
 
Aaron Roberts
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd have to disagree about taking some work to make the app slow. Just go look for a few examples of people making custom components which paint themselves, specifically animated ones which use a thread. Numerous times you find the entire CPU hogged, because the developer didn't put a sleep in the thread anywhere. You also find the entire drawing context being redrawn, instead of the portion which actually changed.

Its lack of programming experience that creates this situation, not Swing, nor SWT, nor Windows, nor Linux.

I'd have to agree with Gregg about lack of evidence anywhere. I think Swing and SWT can live together and be happy. It would be nice if someone had some sort of unit test to stress a window toolkit. Make 100 buttons, press them all 500 times, record how long it took to respond to each event, etc. Might be a tad hard to make it automated.

Regards,
Aaron R>
 
Jeff Duska
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could say this about SWT on Linux and Mac OS X.

I do think that there is a difference, I know a lot people say it is more of a perception. I just don't buy this. I'm talking about key applications such NetBeans. You'd hope that Sun knows how to create robust Swing application.

I know when I start NetBeans or Intellij on Linux it terribly slow via X-Windows. Whereas the Motif version Eclipse is downright snappy in compairson.

SWT is all roses. The GTK+ version, even RedHat's pre-complied version is downright painful on XWindows!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!