Swing is faster than AWT? No way!

Check this post on forms.java.net:

It seems that Sun was right--Swing is nearly twice as fast as AWT, on my machine at least (2 GHz Athlon, GeForce 4 video car, running SuSE 9.0, KDE, and Sun's J2SE 1.4.2). I don't happen to have SWT installed right now, but I would be interested to see how it comes out--my guess is that it would probably beat both AWT and Swing. It might be also interesting to test components besides buttons. :)

Running the fellows benchmark at the iBook, however, gives a different story. Here are some results from Mac OS X 10.3, with whatever resources running that I usually have running when I'm hacking around -- which is to say this isn't exactly a clean room. But the results are still interesting:

iBookG4:~ smack$ java AWTSwingBench AWT
AWT: 30548 milliseconds
iBookG4:~ smack$ java AWTSwingBench AWT
AWT: 30509 milliseconds
iBookG4:~ smack$ java AWTSwingBench Swing
Swing: 112100 milliseconds
iBookG4:~ smack$ java AWTSwingBench Swing
Swing: 112828 milliseconds


Swing is approaching four times slower than AWT in Jobsland.

All about the implementation. Looks like this is another example of Swing apologia built into the runtime, which reminds me of when Netbeans went well out of their way to ensure it acted more Windows-like. That is to say, non-trivial resources seem to have been expended to give Swing the upper hand, as the expected result does, indeed, happen in at least one alternative implementation of Java.

Who has a blackdown.org example? ;^)