bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnubg] 3d speedup (and timecontrol) problem


From: Jon Kinsey
Subject: Re: [Bug-gnubg] 3d speedup (and timecontrol) problem
Date: Mon, 19 Jan 2004 10:55:12 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4

Jim Segrave wrote:
On Fri 16 Jan 2004 (09:49 +0000), Jon Kinsey wrote:

I've added a new option which aims to improve the performance of the 3d board when playing games on slower machines. Note that browsing matches and other actions won't be any faster.

A few things:

misc3d.c uses a macro max which isn't defined in any standard C header
         file

Does MAX compile ok?

get_time() does:

double get_time() {
   return 1000*clock()/CLOCKS_PER_SEC;
}

Under Unix, clock returns clock_t. In Linux, this is a long. The above
line produces negative values for some calls to clock(). Since the
starting value is not specified, this can happen on any call. With the
multiplier of 1000, the range of potential negative values increases -
a value of 2147483 for example goes negative.
Under FreeBSD, clock_t is a unsigned long, which is not quite so bad.

This problem can happen for the time control routines as well. I'd
suggest changing the 1000 to 1000.0, so it might not overflow, and
casting the return from clock() to unsigned long.
A deeper problem is that clock() returns the time for the process
making the call. Under Unix and X, that does not include time spent in
the X server. So my laptop, without graphics acceleration, spent 11
minutes and 3 seconds doing a calibration and concluded I have a very
fast 3d display at 573 frames/second. The real answer is under 3
frames second, but it's all in the X rendering, so that time wasn't
counted. I would assume time controls will also be far to generous
when rendering boards under X.

I've checked in a change which uses gettimeofday, I haven't checked it, I think I've got the micro-seconds bit correct, I'm not sure that this function has a high enough accuracy though.

The 3d display is better, but still unusable, it takes 7 seconds to
move 17/22 and about 12 seconds to move bar/20
This could be a result of the completely miscalculated update rate.

It is, on a slow machine the animation takes the same amount of time (but you get less frames shown).

Jon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]