Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Alternatives to java swing ?

 
Arjun Singh Rampal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have seen that many java programs are slower than others. I guess that swing tends to make execution slower. Are there any alternatives to swing which are much faster ?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12123
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arjun Singh Rampal wrote:I guess that swing tends to make execution slower.

Guessing why something is slow is almost ALWAYS going to give you the wrong answer. Why do you think it is Swing that is slowing things down?
 
Arjun Singh Rampal
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:
Arjun Singh Rampal wrote:I guess that swing tends to make execution slower.

Guessing why something is slow is almost ALWAYS going to give you the wrong answer. Why do you think it is Swing that is slowing things down?


I heard that it does not use the native graphic libraries of an OS. Instead, it calls the native functions indirectly. So, there is some overhead. Sounds believable, but i cant confirm its actual impact on performance.
 
Winston Gutkowski
Bartender
Pie
Posts: 10417
63
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arjun Singh Rampal wrote:I heard that it does not use the native graphic libraries of an OS. Instead, it calls the native functions indirectly. So, there is some overhead. Sounds believable, but i cant confirm its actual impact on performance.

Then before you make any rash decisions, I suggest you do - and make sure your evidence is backed up by statistics, not just anecdotes.

Just as a general rule, a layer of indirection shouldn't add a huge overhead, but it depends entirely on how well it's designed. Not being a Swing expert I couldn't tell you how good Java's is.

It's also possible that what you've heard is an urban myth dating from the times of AWT: A few of those have surfaced over the years, probably the most pernicious being the one that "synchronization is expensive".
Like many myths there was a grain of truth to it, but it caused a lot of programs to be written to avoid synchronization; code which became basically redundant when the Java memory model was upgraded. Unfortunately, by then the damage had been done, and there are still programs around with arcane (and sometimes invalid) code to get around the "problem".

Another thing to think about before you make wholesale changes: There are a lot of Swing programmers out there; how many will there be for whatever superfast, bleeding-edge alternative you choose?

Winston
 
Stephan van Hulst
Bartender
Pie
Posts: 5810
61
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my experience, it's *much* easier to create smooth responsive GUIs in Swing than in AWT for example. The indirection may refer to Swing's lightweight components, which are not notified of repaints by the OS, but by the container holding them. This actually often makes Swing faster, because they use some tricks to try to get the smallest area necessary to repaint.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic