Skip to main content

Why do applets run so much slower than applications?

9 replies [Last post]
qu0ll
Offline
Joined: 2006-12-09
Points: 0

In the process of converting an application to an applet I discovered that exactly the same code seems to run quite a bit slower in an applet when compared to an application. The performance hit is up to about 30% which may not sound significant but for the things we are trying to do this is a worry.

Why should an applet run so much slower than an application? My tests were with Update 10 but this may be a more widespread problem with other versions affected also. It only affects an applet actually running in a browser and doesn't manifest when running in the applet viewer.

I am talking about simple processing power - the applet/application has no GUI and just prints the test results to the console.

Any ideas? Can this be overcome?

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
Qu0llSixFour@gmail.com
[Replace the "SixFour" with numbers to email me]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
qu0ll
Offline
Joined: 2006-12-09
Points: 0

I excepted that there would be no difference between applet and application execution but this is definitely not the way the test is going.

I have tried running the applet with both -client and -server and the results are pretty much identical.

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
Qu0llSixFour@gmail.com
[Replace the "SixFour" with numbers to email me]

qu0ll
Offline
Joined: 2006-12-09
Points: 0

When I say "identical" I mean that both arguments produce the same results which are both slower than the application.

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
Qu0llSixFour@gmail.com
[Replace the "SixFour" with numbers to email me]

qu0ll
Offline
Joined: 2006-12-09
Points: 0

Yes, the platform is Vista but would the lack of hardware acceleration have any effect on an applet that has no GUI and only prints to the console one line of text?

--
And loving it,

-Qu0ll (Rare, not extinct)
_________________________________________________
Qu0llSixFour@gmail.com
[Replace the "SixFour" with numbers to email me]

trembovetski
Offline
Joined: 2003-12-31
Points: 0

> Yes, the platform is Vista but would the lack of hardware acceleration have any effect on an applet that has no GUI and only prints to the console one line of text?

It shouldn't.. I guess I missed that your applet has no gui.

Dmitri

kbr
Offline
Joined: 2003-06-16
Points: 0

There is nothing inherent about applets or the applet execution model that would impact performance. I suspect the difference may be the use (implicit or explicit) of -client vs. -server. Can you confirm this with a command-line version of your application?

You can actually use the new java_arguments applet parameter or the java-vm-args parameter in a new-style applet's JNLP file to specify -server as a JVM command-line argument if this is the issue.

kbr
Offline
Joined: 2003-06-16
Points: 0

And BTW, the Tiered VM support in HotSpot should finally address the discrepancies between client and server execution once and for all.

trembovetski
Offline
Joined: 2003-12-31
Points: 0

What's the platform?

If it's Windows Vista, then there's a bug in Microsoft's Aero (DWM) which caused us to disable hw acceleration for applets (while they're inside the browser).

Dmitri

fatbatman
Offline
Joined: 2004-12-24
Points: 0

Do you think this a bug microsoft will be interested in fixing?

trembovetski
Offline
Joined: 2003-12-31
Points: 0

They know about it, we have worked with Microsoft on this (and we're not the only ones who run into it). They won't say when the fix is coming.

Dmitri