Joerg 'Herkules' Plewe wrote:

> For a flightsim, you need to know times quite precisely. What I tried is
> java.util.Date.getTime(), which claims to be a millisecond timer. In fact,
> on my win98 machine it's a 60ms-timer (see code below).
> Obviously, 60ms is bad, and even worth, the loop runs only 70000 times in
> 5s!
>
> How can I really measure a millisecond?

Simple answer: you can't. The Java implementation does not allow it.

Today, it is impossible to implement hard or even soft realtime systems
with Java. There is no guaranteed scheduling of threads. Also, as you
have noticed, the time slice accuracy of the various time functions is
pretty terrible. On Win9X boxes, it is around 50ms. On NT, you get
around 10ms and a unix box (we've tried solaris/hpux) you do get to
around 1 or 2 ms.

Also, if you are planning to implement a realtime system like a flight
sim, Java3D is most definitely not the answer. The performance just does
not cut it relative to a native app unless you are willing to take about
a 50% framerate cut. Then you also have problems with the GC kicking in
when you least expect it (even if you've been extremely careful not to
generate garbage) Sun claims that Java 3D 1.2 will be much closer to
native speed, but since there is no code available yet, we can't verify
the claims.

If you really need realtime capabilities either write it in native code
(C/C++) or take a look at the HP efforts on this front. However, note
that you won't have anything to help synchronise frames across into J3D
because it doesn't use the same threading libs etc.

--
Justin Couch                                   Author, Java Hacker
Snr Software Engineer                     [EMAIL PROTECTED]
ADI Ltd, Systems Group              http://www.vlc.com.au/~justin/
Java3D FAQ:       http://tintoy.ncsa.uiuc.edu/~srp/java3d/faq.html
-------------------------------------------------------------------
"Look through the lens, and the light breaks down into many lights.
 Turn it or move it, and a new set of arrangements appears... is it
 a single light or many lights, lights that one must know how to
 distinguish, recognise and appreciate? Is it one light with many
 frames or one frame for many lights?"      -Subcomandante Marcos
-------------------------------------------------------------------

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to