Applet speed

Christopher Arthur

Ranch Hand

Posts: 149

posted 12 years ago

Hello, I'm kind of new to writing applets. I just made my first one. It performs a lot of mathematical computation, and there is something I have noticed: the same program ran much faster as an application than it does as an applet. The difference in speed is around 2 to 3 times at least. Is this typical of applets, or have I possibly done something to cause this when I converted my application to an applet? Basically, I just made a simple form with a jbutton on it that sits in the browser window, and when the user pushes the button, it calls the main class of my application with a call like: MyApplication.main(args); The only other thing that I did was put a call in the paint() method to initalize the form. If applets truly do run slower, then would I have better performance using Java Web Start and keeping the application as is? Chris

Chris Stehno

Ranch Hand

Posts: 180

posted 12 years ago

I am not entirely clear about what you are doing, but here is what I see: You have a simple application to perform a calculation that spits results to the console or something simple. You wrapped an applet around that application and put it on a webpage. Now, in your speed testing are you doing actual timing or just eye-balling it? First, make sure that you are only timing your application code and not any of the applet setup or rendering... basically just your main() method from your example. Applet rendering can be slow, depending on too many factors to go into. Without a detailed account of the code and the results, it is hard to give a more detailed response. Hope this helps, C