Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: printing pv slow down question

Author: Mathieu Pagé

Date: 16:08:24 08/16/04

Go up one level in this thread


On August 16, 2004 at 09:30:58, Uri Blass wrote:

>On August 15, 2004 at 18:46:04, Mathieu Pagé wrote:
>
>>On August 15, 2004 at 15:24:36, Uri Blass wrote:
>>
>>>On August 15, 2004 at 15:16:17, Mathieu Pagé wrote:
>>>
>>>>On August 15, 2004 at 12:13:59, Uri Blass wrote:
>>>>
>>>>>On August 15, 2004 at 12:01:56, Andrew Platt wrote:
>>>>>
>>>>>>Do not underestimate the cost of writing to Windows terminals! Particularly if
>>>>>>the output is unbuffered it can be quite intense. Try this: Open a file as a
>>>>>>test and send the output to there (default buffering of fopen is fine). See if
>>>>>>you see the same slowdown.
>>>>>>
>>>>>>Andy.
>>>>>
>>>>>It cannot be the cost of writing because the difference between times when there
>>>>>is no additional writing is also significantly bigger.
>>>>>
>>>>>I do not understand what is unbuffered output.
>>>>>
>>>>>I use fflush(stdout) after every printf but I know that I need to use
>>>>>fflush(stdout) after lines that I print (otherwise the program may work in text
>>>>>mode but not under winboard)
>>>>
>>>>Hi Uri,
>>>>
>>>>You are right, in order to work in Winboard you need to do fflush() after each
>>>>output if you want winboard to get it instantly. However there is some
>>>>informations that you send to winboard that did not need to be send so rapidely
>>>>(like PV informations). So I sugest you to try (i did not) to use fflush only
>>>>after critical informations like returning move, pong, etc. But not after pv.
>>>>I'm absolutely not sure if it will help, so you should test it.
>>>>
>>>>Mathieu P.
>>>
>>>If the problem is speed of fflush I could expect no slow down when there is no
>>>additional fflush but it is not the case.
>>>
>>>I already found a way to do the code more clearer and faster by dividing the
>>>file iterate.c to 2 files when one of them is for searching the root moves like
>>>crafty.
>>>
>>>Movei still has not enough files relative to crafty and I probably should divide
>>>the program to more files.
>>>
>>>Uri
>>
>>Are you telling that the overhaed you are experiencing is not due to writing to
>>stdout, but due to youre pv retreiving function ?
>>
>>Mathieu Pagé
>
>Yes
>
>It is clearly not because of writing to stdout but because the compiler does not
>like additional calls to my pv retreiving function(this function is called
>rarely).
>
>Uri

Hi Uri,

I must admit i'm clueless.

maybe you could use a profiler in order to see what take so much time in this
function.

If you use VC++ (2003 or 2002)you can use "Dev Partner Comunity profiler" it's
free, and yet a good tool.

Mathieu P.



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.