Speed in Java applet viewer vs browser

During development, I’ve been testing my applet from eclipse, and that’s using applet viewer (javaw). It runs smoothly, and is a beauty to behold. In a browser, it runs jerkily and is unresponsive.

Admittedly, I’ve added a bunch of stupid effects lately and increased the screen size, so I could understand why it was slow… If it was slow in applet viewer as well as the browser window!

Is there anything I can do to make it run ok in the browser, rather than paring down the code or making it more efficient?

Well, no.

Either there’s a bug that makes it slow or your code and or how you’ve done it is making it slow. It also depends on what you’re using, basic java and java2d or LWJGL or LibGDX.

If the things that you’re doing (effects or whatever) are being done smoothly by other similar applets then you might consider why that is and how you could make your code more efficient.

Using OpenGL libraries like LWJGL, LibGDX or JOGL allows you to take advantage of the graphics card and make rendering a lot faster. This comes with a longer loading speed (loading speed doesn’t really matter anyway) and more disciplined rendering/programming practices.

Short answer:

[quote]Is there anything I can do to make it run ok in the browser, rather than paring down the code or making it more efficient?
[/quote]
No.

In java2d you may run in the problem that a different rendering backend is picked. You have minimal control over this with configurable vm parameters.

Thanks for the answers… Reading more on different parameters that can be set… Specifically http://www.java-gaming.org/topics/sun-java2d-opengl-true-in-applet-with-bufferstrategy/25988/view.html