Sjeng timing code

Archive of the old Parsimony forum. Some messages couldn't be restored. Limitations: Search for authors does not work, Parsimony specific formats do not work, threaded view does not work properly. Posting is disabled.

Sjeng timing code

Postby Andrew Tanner » 27 Apr 2000, 15:17

Geschrieben von: / Posted by: Andrew Tanner at 27 April 2000 16:17:46:
hello,
has anyone tweaked Sjeng's timing code to have it manage it's time more efficiently in blitz games? I have been trying it myself by editing utils.c but have yet to get any improvement.
thanks, A. Tanner
Andrew Tanner
 

Re: Sjeng timing code

Postby Dann Corbit » 27 Apr 2000, 19:49

Geschrieben von: / Posted by: Dann Corbit at 27 April 2000 20:49:02:
Als Antwort auf: / As an answer to: Sjeng timing code geschrieben von: / posted by: Andrew Tanner at 27 April 2000 16:17:46:
hello,
has anyone tweaked Sjeng's timing code to have it manage it's time more efficiently in blitz games? I have been trying it myself by editing utils.c but have yet to get any improvement.
For my compiler 7.2 was completely broken in the timing code. I must use the code from 7.1, along with the bugfixes that were in 7.2.
Have you tried the 7.1 source?
I have a high resolution timer written by me in C++ that is freely available. Anyone who wants to use it can do so for any purpose.
ftp://38.168.214.175/pub/TIMER.ZIP


My FTP site
Dann Corbit
 

Timing code 7.1

Postby Andrew Tanner » 27 Apr 2000, 20:53

Geschrieben von: / Posted by: Andrew Tanner at 27 April 2000 21:53:17:
Als Antwort auf: / As an answer to: Re: Sjeng timing code geschrieben von: / posted by: Dann Corbit at 27 April 2000 20:49:02:
hello,
has anyone tweaked Sjeng's timing code to have it manage it's time more efficiently in blitz games? I have been trying it myself by editing utils.c but have yet to get any improvement.
For my compiler 7.2 was completely broken in the timing code. I must use the code from 7.1, along with the bugfixes that were in 7.2.
Have you tried the 7.1 source?
I have a high resolution timer written by me in C++ that is freely available. Anyone who wants to use it can do so for any purpose.
ftp://38.168.214.175/pub/TIMER.ZIP
Yes the 7.1 source is what I compiled using GCC. Once Sjeng is out of book it just doesn't seem to use it's time wisely as compared to the average winboard engine. I would really be interested in seeing it's blitz performance once this gets optimized.
Andrew Tanner
 

Re: Timing code 7.1

Postby Dann Corbit » 27 Apr 2000, 21:03

Geschrieben von: / Posted by: Dann Corbit at 27 April 2000 22:03:47:
Als Antwort auf: / As an answer to: Timing code 7.1 geschrieben von: / posted by: Andrew Tanner at 27 April 2000 21:53:17:
hello,
has anyone tweaked Sjeng's timing code to have it manage it's time more efficiently in blitz games? I have been trying it myself by editing utils.c but have yet to get any improvement.
For my compiler 7.2 was completely broken in the timing code. I must use the code from 7.1, along with the bugfixes that were in 7.2.
Have you tried the 7.1 source?
I have a high resolution timer written by me in C++ that is freely available. Anyone who wants to use it can do so for any purpose.
ftp://38.168.214.175/pub/TIMER.ZIP
Yes the 7.1 source is what I compiled using GCC. Once Sjeng is out of book it just doesn't seem to use it's time wisely as compared to the average winboard engine. I would really be interested in seeing it's blitz performance once this gets optimized.
The portable routines used by Sjeng are (necessarily) inaccurate. See (for instance) C-FAQ question 19.37:
19.37: How can I implement a delay, or time a user's response, with sub-
second resolution?
A: Unfortunately, there is no portable way. V7 Unix, and derived
systems, provided a fairly useful ftime() function with
resolution up to a millisecond, but it has disappeared from
System V and POSIX. Other routines you might look for on your
system include clock(), delay(), gettimeofday(), msleep(),
nap(), napms(), nanosleep(), setitimer(), sleep(), times(), and
usleep(). (A function called wait(), however, is at least under
Unix *not* what you want.) The select() and poll() calls (if
available) can be pressed into service to implement simple
delays. On MS-DOS machines, it is possible to reprogram the
system timer and timer interrupts.
Of these, only clock() is part of the ANSI Standard. The
difference between two calls to clock() gives elapsed execution
time, and may even have subsecond resolution, if CLOCKS_PER_SEC
is greater than 1. However, clock() gives elapsed processor time
used by the current program, which on a multitasking system may
differ considerably from real time.
If you're trying to implement a delay and all you have available
is a time-reporting function, you can implement a CPU-intensive
busy-wait, but this is only an option on a single-user, single-
tasking machine as it is terribly antisocial to any other
processes. Under a multitasking operating system, be sure to
use a call which puts your process to sleep for the duration,
such as sleep() or select(), or pause() in conjunction with
alarm() or setitimer().
For really brief delays, it's tempting to use a do-nothing loop
like
long int i;
for(i = 0; i < 1000000; i++)
;
but resist this temptation if at all possible! For one thing,
your carefully-calculated delay loops will stop working properly
next month when a faster processor comes out. Perhaps worse, a
clever compiler may notice that the loop does nothing and
optimize it away completely.
References: H&S Sec. 18.1 pp. 398-9; PCS Sec. 12 pp. 197-8,215-
6; POSIX Sec. 4.5.2.
The only way to get highly accurate timing for a given implementation is to use system specific code. All portable solutions are not guaranteed to be accurate to high resolution.


My FTP site
Dann Corbit
 

Re: Timing code 7.1

Postby Gian-Carlo Pascutto » 30 Apr 2000, 20:30

Geschrieben von: / Posted by: Gian-Carlo Pascutto at 30 April 2000 21:30:15:
Als Antwort auf: / As an answer to: Re: Timing code 7.1 geschrieben von: / posted by: Dann Corbit at 27 April 2000 22:03:47:
hello,
has anyone tweaked Sjeng's timing code to have it manage it's time more efficiently in blitz games? I have been trying it myself by editing utils.c but have yet to get any improvement.
Yes the 7.1 source is what I compiled using GCC. Once Sjeng is out of book it just doesn't seem to use it's time wisely as compared to the average winboard engine. I would really be interested in seeing it's blitz performance once this gets optimized.
The portable routines used by Sjeng are (necessarily) inaccurate. See (for >instance) C-FAQ question 19.37:
[...]
Even with accurate timing routines Sjeng's handling of time isn't exactly up to pair. I didn't put much thought into them, but have been focusing on the search and bug/zh support for now. So if you come up with better routines, I'd be a great improvement. I'm going to write some nice new opening book code myself now.
As for portability, Sjeng uses ftime/gettimeofday/time depening on its platform. If tries to figure out what to use with autoconf. I added this in 7.2 so there might still be some trouble with it, as Dann's bugreports illustrate. (and it seems that ftime isn't always accurate to ms anyway, so there is no sense in using it on a unix platform I think)
Anyway, thanks for your interest in Sjeng. Your feedback is very much appreciated.
--
GCP


Sjeng's homepage
Gian-Carlo Pascutto
 


Return to Archive (Old Parsimony Forum)

Who is online

Users browsing this forum: No registered users and 19 guests