Results 1 to 9 of 9
- 05-10-2012, 01:21 PM #1
Member
- Join Date
- Feb 2011
- Posts
- 10
- Rep Power
- 0
Java applet strange performance problem
I have a Java applet which does simple animation.
For testing, I created a simple html page with an applet tag which referenced a local copy of the applet jar on my PC. It runs at a reasonable speed.
Then I put the applet jar on a remote web server, and the html page (modified to reference the remote applet). Same browser, identical jar file, it gets downloaded and cached on my machine and runs locally.
But it is 100 times slower. What was smooth animation becomes a picture which just jumps after a few seconds. This isn't a startup problem, it is a runtime problem.
Does anyone know what could be causing this? How can the same jar file perform so differently, both are running from different folders on the same disk?
The only thing I am wondering, the applet is not signed. I guess the local one is trusted but the remote one isn't. Could extra security checks be slowing it down? Is it likely to help if I self sign the applet?
- 05-10-2012, 02:37 PM #2
Re: Java applet strange performance problem
How are you loading your images? What happened when you signed the jar?
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 05-10-2012, 04:04 PM #3
Member
- Join Date
- Feb 2011
- Posts
- 10
- Rep Power
- 0
Re: Java applet strange performance problem
The software doesn't use images. It plots animated graphs, drawn with java 2d.
I tried signing the applet (self cert) and it is coming up with the standard warning dialog as you would expect. But it still runs just as slow.
I am stumped by this at the moment - it is obviously possible for the browser to run the applet at full speed because that is what happens when I run the local copy. I can't figure out what the difference is with the remote version.
- 05-10-2012, 04:15 PM #4
Re: Java applet strange performance problem
When you run an applet, it downloads the jar to a temp folder and runs it from there. So it's still running locally.
But without an SSCCE, we can't really help you other than to guess.How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 05-10-2012, 04:20 PM #5
Member
- Join Date
- Feb 2011
- Posts
- 10
- Rep Power
- 0
- 05-10-2012, 04:24 PM #6
Re: Java applet strange performance problem
Do you have code in a painting method override that attempts to communicate with the server?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 05-10-2012, 11:41 PM #7
Member
- Join Date
- Feb 2011
- Posts
- 10
- Rep Power
- 0
Re: Java applet strange performance problem
There is no communication with the server, aside from opening a server side XML file to set up the animation. That happens at startup, and the file is closed before the animation runs.
I made an SSCCE, but of course it runs fine, doesn't show the same problem :(
I was hoping I would ask here and find out this is a common problem that can be fixed easily. Looks like it is specific to the software I am working on (sadly a fairly complicated desktop app I am converting to an applet). Thanks for the suggestions.
- 05-11-2012, 09:45 AM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Re: Java applet strange performance problem
If you have s simple version working OK then you might be stuck with the fun task of adding bits and seeing which part is causing the problem.
The first thing I would look at, though, is that remote XML.
I would lay good odds on that (since it's the only remote resource you are using) being the culprit.Please do not ask for code as refusal often offends.
- 05-19-2012, 10:46 PM #9
Member
- Join Date
- Feb 2011
- Posts
- 10
- Rep Power
- 0
Re: Java applet strange performance problem
Some more information, perhaps it will ring a bell with someone. It looks like it is something to do with either TextLayout or FontMetrics.
The problem is associated with some code which draws formatted maths expressions. They take around 0.5 sec or more to draw in the remote applet case, but far, far less for an applet hosted locally. This is hardly a problem for static diagrams, but when the diagram animates and tries to redraw the canvas 24 times a second it is wrecked.
The only obvious difference between the maths expressions and ordinary text (which has no problem) is the use of TextLayout/FontMetrics to render the equation. Even a very simple expression "x" shows the problem.
I will try to post back if I ever track this down. At the moment it is on the pile of "important but not quite as urgent as some other stuff".
Similar Threads
-
Java Applet Strange Image Loading Problem
By 1yuchen in forum Java AppletsReplies: 36Last Post: 01-06-2012, 02:06 AM -
applet loading errors strange?!
By newbie_jar in forum Java AppletsReplies: 1Last Post: 11-08-2011, 05:35 PM -
Getting Focus in an embedded applet? And strange error reports
By Reskaillev in forum New To JavaReplies: 12Last Post: 07-25-2011, 03:25 PM -
Applet performance problem...
By pmrenaud in forum Java AppletsReplies: 0Last Post: 01-07-2009, 03:47 PM -
Java applet strange painting behaviour
By sirdori in forum New To JavaReplies: 1Last Post: 01-07-2009, 01:14 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks