Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: *WEIRD* MVSC 6.0 behavior. I think I got it

Author: Dan Newman

Date: 14:21:46 04/18/01

Go up one level in this thread


On April 18, 2001 at 10:44:52, Miguel A. Ballicora wrote:

>On April 17, 2001 at 11:37:38, Miguel A. Ballicora wrote:
>
>>On April 16, 2001 at 15:28:32, Jon Dart wrote:
>>
>>>
>>>If you use the bit scan instructions (e.g. bts), these are way faster on a PIII
>>>than on an AMD chip. I think the integer multiply on a K6-2 is a lot slower too.
>>
>>I don't use assembler, it is just in plain ANSI-C. The good thing is
>>that allows me to change compilers with no change in the code whatsoever and
>>that is what I did.
>>Maybe the MVSC uses some of those instructions when chew up my sources and
>>gcc don't?
>>
>>The weird thing is that K6-2 is not slow _if_ I use gcc. With the rest of
>>the machines MVSC is better...
>>
>>Regards,
>>Miguel
>
>Last night I left the program profiling in MVSC and I found out this morning
>before going to work that 50% of the cpu time is consumed by a function that the
>only thing it does is to call clock(), which is an ANSI C standard function!!!!
>I commented out clock(), only one line in the whole program and the speed
>increased 300%!!! now, the speed is the same as the executable obtained with
>gcc.
>WEIRD... it means that clock() somehow is broken if MVSC is used only in
>K6-2????
>Has anybody ever seen anything like it? is that a bug?
>I might have to use time() or maybe something non-standard. This teaches me
>a lesson: you could be compiling something perfectly on one machine but you
>release a version that could be broken somehow in a particular machine.
>
>I will have to test more things when I get home.
>
>Regards,
>Miguel
>


clock() is supposed to return the cpu time consumed by the calling
process.  IIRC, the MS version of clock() just returns wall-clock time
--but that might have been corrected by now.  (Actually, what you
want for chess *is* a wall-clock timer...)  Another problem clock()
has is that it has a very low resolution (1/18.2 of a second, IIRC).

I used to use clock(), but more recently I've been using a Windows API
call, QueryPerformanceCounter(), which gives a much higher resolution.
Its resolution depends on the hardware involved--it can be sub-
microsecond.  The documentation implies that the hardware timer on
which it depends isn't available on all systems, so it might not work
yours--but I'd be surprised if it didn't.  You use another function,
QueryPerformanceFrequency(), to find out if the timer exists and what
its resolution is.

-Dan.

>
>
>
>
>>
>>
>>>
>>>--Jon



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.