Skip to main content

Strange Timing issue between platforms

5 replies [Last post]
tedminator
Offline
Joined: 2007-06-18
Points: 0

I wrote a simple applet to animate a button moving up and down. Click on the button is moves down for 1 second. Click again, it moves up for 1 second.

When I ran the applet (in firefox) on my sun box, where I do my development, it worked fine.

However, when I then ran the exact same code on my windows laptop (through both firefox and IE), the animation "seemed" to be exactly twice as slow - that is to say, click on the button and it moves down for 2 seconds (same distance as before) - click again and it moves up for 2 seconds (again same distance). The frame rate itself doesn't seem to change appreciably.

Any clues to the strange behavior ?
I am using version 0.55 of the TimingFramework.

-thanx

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rah003
Offline
Joined: 2004-05-26
Points: 0

Occasionally there were some strange differences in timing reported by other people. Most often it goes down to underlying OS/HW timers. Could you run ExternalTimer from examples and post the resolution results? Are you running same version of JVM on both systems? Also what is the spec of the windows laptop?

Cheers,
Jan

tedminator
Offline
Joined: 2007-06-18
Points: 0

Sorry for getting back so late ... I'll about see about running the External Timer ...

The Windows box is a 2.0 Ghz Pentium - JVM 1.6

The unix box is a dual 1.2 GHz Sparc - JVM 1.5

Would the version difference make that much of a difference ?

rah003
Offline
Joined: 2004-05-26
Points: 0

No it should not make a difference, or at least not so much. I'm using timingframework on windows all the time and works just fine.
... maybe I'm wrong but is it possible that you are doing some fairly expensive graphics calculations or trying to paint some big textured areas on a screen inside of your animation? If that is the case it maybe just slow graphics card so it takes very long before the operation is finished.
If you can make your problem into self contained test case, I'll try to run it and have a look if I can find anything.

Jan

tedminator
Offline
Joined: 2007-06-18
Points: 0

I finally got to run the ExternalTimer ..:
On windows:
resolution = 0.8795075
resolution = 0.22773856
resolution = 2.65252

On Sun Server:
resolution = 19.607.843
resolution = 10.0
resolution = 29.411764

I can send you the source code for my program or upload it somewhere (about 119 lines) ...

rah003
Offline
Joined: 2004-05-26
Points: 0

Don't know how much you have looked into what those results means so here's the explanation:
first one is how closely can timer time events with resolution 20ms using swing.Timer internally for timing the events. So result should be close to 20 ...
Second is how is running the same with resolution set to 0ms (so in theory there is no gap between events) and using Thread.sleep() for timing the events ... so closer the result is to 0 the better is precision of timing on your platform
Third result is same as first one (resolution 20ms) but using Thread.sleep() for timing instead of swing Timer. So again good result should be somehow close to 20 ...

Here is the same for my windows PC:
resolution = 29.411764
resolution = 0.48332527
resolution = 20.408163

... if you compare results to you Sun Server you find out that your Sun achieves better precision using swing.Timer while my windows seems to do better using Thread.sleep()

Now as for your windows results ... they seem to be seriously crooked and honestly I'm lacking the explanation why. It seems like timer returns almost immediately without actually timing anything.

You can send me your code to [my user name] at gmail and I'll try to run it, but I'm almost sure now that it is not the code that causes problem but problematic timing on your windows.

Jan