Running the following program produces wrong results on certain systems, in this case using java 1.7 for execution on Windows based PCs. Is there something in the way the timers are used that causes the errors?
http://www.java2s.com/Code/Java/Swing-JFC/TimeResolution.htm
I believe that this was the reason that my Java drawing benchmark was slow:
Why is Java drawing slow on a new PC? - VSYNC?
Following are results where Ubuntu and Windows using Java 1.6 appear to produce the expected results. Perhaps the strangest are Sleep Time of just 10 and 20 ms and others doubling at 16 ms.
Javac 1.7 1.6 1.7 1.6 1.7 1.6 1.6 1.6
Java 1.7 1.7 1.7 1.7 1.7 1.7 1.6 1.6
CPU Core i7 ----------------------- Phenom ------- Core 2a Core 2b
OS Win 8.1-------- Ubuntu 14 ---- Win 7 ------- Win Vista ----
Bits 64 64 64 64 64 64 32 64
new
Timer ------------------------- per delay -------------------------
delay
0 15.66 15.66 0.18 0.72 0.11 0.22 1.04 1.08
1 15.63 15.63 1.20 1.34 15.60 15.60 1.01 1.04
2 15.62 15.62 2.18 2.18 15.60 15.60 2.02 3.22
3 15.62 15.62 3.18 3.18 15.60 15.60 3.00 3.23
4 15.62 15.62 4.18 4.18 15.60 15.60 4.00 4.25
5 15.63 15.63 5.18 5.18 15.60 15.60 5.00 5.43
6 15.62 15.62 6.17 6.17 15.60 15.60 6.01 6.61
7 15.62 15.62 7.17 7.18 15.60 15.60 7.01 7.97
8 15.62 15.62 8.18 8.17 15.60 15.60 8.00 8.80
9 15.62 15.62 9.17 9.17 15.59 15.59 9.00 9.09
10 15.62 15.62 10.17 10.17 15.60 15.60 10.00 10.07
11 15.62 15.62 11.17 11.17 15.60 15.60 11.00 11.04
12 15.63 15.63 12.18 12.17 15.59 15.59 12.00 12.18
13 15.62 15.62 13.17 13.17 15.59 15.59 13.00 13.09
14 15.62 15.62 14.17 14.18 15.59 15.59 14.00 14.10
15 15.62 15.62 15.17 15.17 15.59 15.59 15.00 15.00
16 31.24 31.24 16.18 16.18 31.19 31.19 16.00 16.05
17 31.24 31.24 17.17 17.17 31.19 31.19 17.00 17.28
18 31.24 31.24 18.16 18.15 31.20 31.20 18.00 18.00
19 31.25 31.25 19.15 19.15 31.19 31.19 19.00 19.00
20 31.24 31.24 20.16 20.16 31.20 31.20 20.00 20.04
XXXXX XXXXX ?XXXX ?XXXX
sleep ------------------------ per sleep -------------------------
time
0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
1 1.03 1.03 1.09 1.09 1.02 1.02 1.00 1.01
2 2.13 2.15 2.08 2.09 2.03 2.00 2.00 2.04
3 3.16 3.16 3.08 3.09 3.05 3.03 3.00 3.05
4 4.22 4.19 4.08 4.09 4.06 4.00 4.00 4.04
5 5.23 5.14 5.09 5.09 5.07 5.01 5.00 5.07
6 6.21 6.19 6.08 6.08 6.08 5.99 5.99 6.07
7 7.37 7.35 7.08 7.08 7.09 6.99 6.99 7.11
8 8.16 8.24 8.08 8.08 8.06 7.99 7.99 8.08
9 9.26 9.16 9.08 9.08 9.08 8.99 8.99 9.01
10 15.61X 15.61X 10.08 10.08 15.61X 15.61X 9.99 10.09
11 11.29 11.22 11.08 11.09 11.13 11.09 10.99 11.04
12 12.20 12.23 12.08 12.08 12.08 12.05 11.99 12.00
13 13.30 13.25 13.08 13.08 13.04 12.99 13.00 12.99
14 14.34 14.52 14.08 14.08 14.44 13.99 14.00 14.01
15 15.17 15.18 15.08 15.08 15.02 14.98 14.98 15.11
16 16.15 16.24 16.08 16.08 16.08 15.98 15.98 16.08
17 17.22 17.17 17.09 17.09 17.00 16.98 16.98 17.05
18 18.11 18.31 18.07 18.07 18.02 17.98 17.98 18.00
19 19.25 19.50 19.08 19.08 19.00 18.98 19.00 19.13
20 31.22X 31.22X 20.08 20.08 31.22X 31.22X 19.98 19.98
Wait -------------------------- per wait -------------------------
time
1 15.62 15.62 1.09 1.09 15.60 15.60 1.01 1.01
2 15.62 15.62 2.09 2.09 15.60 15.60 2.00 2.04
3 15.62 15.62 3.08 3.09 15.60 15.60 3.00 3.05
4 15.62 15.62 4.08 4.09 15.60 15.60 4.00 4.06
5 15.61 15.61 5.09 5.09 15.60 15.60 4.99 5.04
6 15.61 15.61 6.08 6.09 15.59 15.59 5.99 6.05
7 15.61 15.61 7.08 7.09 15.59 15.59 7.00 7.01
8 15.61 15.61 8.08 8.09 15.59 15.59 7.99 8.02
9 15.60 15.60 9.08 9.08 15.59 15.59 9.01 9.03
10 15.61 15.61 10.08 10.08 15.59 15.59 9.99 10.03
11 15.60 15.60 11.08 11.09 15.59 15.59 10.99 11.12
12 15.61 15.60 12.08 12.08 15.58 15.58 12.06 12.02
13 15.61 15.61 13.08 13.08 15.58 15.58 12.99 13.07
14 15.61 15.59 14.08 14.08 15.58 15.58 13.99 14.07
15 15.59 15.59 15.08 15.09 15.58 15.58 14.98 15.23
16 31.23 31.23 16.08 16.08 31.18 31.18 15.98 16.08
17 31.22 31.22 17.09 17.09 31.17 31.17 16.98 17.02
18 31.22 31.22 18.07 18.07 31.18 31.18 17.98 18.05
19 31.23 31.21 19.08 19.08 31.17 31.17 18.98 19.04
20 31.22 31.22 20.08 20.10 31.18 31.18 19.98 20.14
XXXXX XXXXX XXXXX XXXXX