File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes Applet lags in IE, but not FireFox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Applet lags in IE, but not FireFox" Watch "Applet lags in IE, but not FireFox" New topic
Author

Applet lags in IE, but not FireFox

Amanda Albert
Ranch Hand

Joined: Jun 12, 2006
Posts: 41

The basic gist of my applet is this: the user clicks a button, moves the mouse in a blank area, after a certain number of data points are collected, the applet performs some functions, then displays the results in a JList. I had several people access the web page all at once. Some people experienced a lag in Internet Explorer, but never in Firefox. The IE lag was inconsistent; some people experienced it, others did not. The lag occurs after the final data point is collected, and before the results are displayed. The lag was up to 15 seconds.

I've made some tweaks to the code, but since the lag doesn't occur in Firefox, and no errors are generated, I can't determine the issue. Here is the information I know:

IE version = 7
FF version = 3.5.5
JVM version = 1.6.17

I hope this isn't a too open-ended question. I was hoping someone would have generic thoughts on why the performance would be different between the two browsers. Also, I was going to try using the Executor interface so I can generate threads that return the calculations to the applet. Perhaps this will help as well.

I appreciate your thoughts.


Sun Certified Programmer for the Java 2 Platform 1.4
Amanda Albert
Ranch Hand

Joined: Jun 12, 2006
Posts: 41

I have a development on this. I noticed the lag occurs when the browser has already been open for a while. The "fix" is to close the browser and reopen it; when I access the applet again, there is no lag.

So this makes me think it's a caching issue. I just did a quick Google and programmatically clearing the cache is frowned upon, if not impossible. Then I found a post where someone suggested adding the following tag to the HTML page:

I realize this will prevent the browser from caching *this* page, but I don't think this solves my problem of an "already full" cache.

Thoughts?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18127
    
    8

Your idea of having several people access the web page at the same time suggests that you think there may be something server-related which causes the applet's slow-down problem. Whereas your post suggests that the applet is just doing some calculations and not accessing the server at all.

And then you suggest that there's a caching problem. But again, your description of the applet doesn't suggest that it is doing anything which requires caching at all.

So it seems to me that you are running off solving problems before you have identified what the problem is. However I could be wrong, because I really don't know what the applet is doing. Perhaps those calculations do access the server and download data which gets cached; you didn't say anything about them.
Amanda Albert
Ranch Hand

Joined: Jun 12, 2006
Posts: 41

My applet is pretty self contained. On load, it reads from a file once and stores the data in a collection. When the applet needs to perform the bulk of its duty, it accesses the collection, which is fairly large. That's why I initially thought it might be a problem with the efficiency of my code, but I even doubted that because the problem didn't occur all the time or for everyone. Now I'm pretty sure it's a browser cache problem, but I'm wondering if there is something I can do in my program to mitigate against that.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18127
    
    8

Amanda Albert wrote:Now I'm pretty sure it's a browser cache problem...
It still isn't obvious to me why the browser cache would have anything at all to do with the applet's processing. The browser will cache resources as it downloads them, so that it can avoid downloading the same thing again later. So yes, it would cache your applet's class file when it downloads it.

However the applet does its calculations after it has been downloaded. I don't understand why that would cause the browser to cache other things, or to look for anything in the cache, or why it would have anything at all to do with the browser's caching mechanism. Perhaps you could explain exactly what this "cache problem" involves, because I think that's a total red herring.
Amanda Albert
Ranch Hand

Joined: Jun 12, 2006
Posts: 41

I'll try to better re-explain what I'm experiencing now. I noticed that if I open either browser and access my applet as the very first thing, there is no lag. If I access the applet after the browser has already been opened for a few hours and various other sites/applets have been accessed, then there is a lag. When I close the browser, re-open it, and re-access the applet, there is no lag. This changed a little this morning when a co-worker opened the applet as the first thing in his IE browser and experienced the lag; but once he cleaned his cache, and deleted his cookies, there was no lag in the applet.

Perhaps, like you mentioned earlier, this is all irrelevant, and just a coincidence of another problem. That's what I'm trying to figure out. I really don't think it's a problem with my applet's code/processing since the problem doesn't occur all the time and wasn't easy to duplicate at first, until I closed my browser. So what else could it be?

I do appreciate your responses to the matter.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet lags in IE, but not FireFox
 
Similar Threads
Using mySQL with Applets
IE: done or loading?
Lag in IE, not in Firefox
showDocument doesn't work on IE
package javax.servlet does not exist