% time moves generator vs. evaluation vs search?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

% time moves generator vs. evaluation vs search?

Post by Luis Babboni »

Hi people.

(As always my question could be nonsense cause my zero background in this matter).

Is correct to say that the moves generator; the evaluation and the search get differents amounts of the total time an engine uses to think?
If is the case, is possible to say around how many in % each one use to consume in a typical engine?

Thanks.
zd3nik
Posts: 193
Joined: Wed Mar 11, 2015 3:34 am
Location: United States

Re: % time moves generator vs. evaluation vs search?

Post by zd3nik »

Luis Babboni wrote:Hi people.

(As always my question could be nonsense cause my zero background in this matter).

Is correct to say that the moves generator; the evaluation and the search get differents amounts of the total time an engine uses to think?
If is the case, is possible to say around how many in % each one use to consume in a typical engine?

Thanks.
This is a good question as far as I'm concerned.

I've never done exact measurements, but I'd expect most of the thinking time is move generation and positional evaluation. The search routine itself certainly accounts for some of it, but I'm guessing a very small amount.

There are a lot of factors that go into movegen and position eval. so time spent in either could swing dramatically depending on which engine(s) you're looking at. For example, engines that use lazy eval probably spend more time in move generation because most positions don't require full evaluation to determine whether they're outside the alpha/beta window, and lazy eval is very quick in most cases. And engines that do "smart" move generation or put a lot into move scoring for sorting purposes may spend more time in move generation than positional eval.

My engines typically do full evaluation on every position, even in quiescence search. So I'd say they spend more time doing evaluation than anything else.

STC
zd3nik
Posts: 193
Joined: Wed Mar 11, 2015 3:34 am
Location: United States

Re: % time moves generator vs. evaluation vs search?

Post by zd3nik »

zd3nik wrote:My engines typically do full evaluation on every position, even in quiescence search. So I'd say they spend more time doing evaluation than anything else.
But my engines aren't exactly the cream of the crop, so don't take that as ay sort of standard. :)

STC
kbhearn
Posts: 411
Joined: Thu Dec 30, 2010 4:48 am

Re: % time moves generator vs. evaluation vs search?

Post by kbhearn »

i don't know that these numbers are accurate for the current version, but a google search returned the following screenshot for profiling stockfish:

https://15524178244135319419.googlegrou ... MPFumJPXtA

I can't say for sure this is typical (i think i've seen engine profiles broken down where eval was as much as 50% of execution time), but certainly eval does tend to come out to the biggest single time sink of your typical engine.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: % time moves generator vs. evaluation vs search?

Post by Luis Babboni »

Thanks guys!
So my conclusion is that evaluation time needed is not negligible as I had fear cause my projected engine will use no little for it. :D
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: % time moves generator vs. evaluation vs search?

Post by lucasart »

Luis Babboni wrote:Thanks guys!
So my conclusion is that evaluation time needed is not negligible as I had fear cause my projected engine will use no little for it. :D
why would you expect eval to be negligible ?
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: % time moves generator vs. evaluation vs search?

Post by Luis Babboni »

lucasart wrote:
Luis Babboni wrote:Thanks guys!
So my conclusion is that evaluation time needed is not negligible as I had fear cause my projected engine will use no little for it. :D
why would you expect eval to be negligible ?
I do not know, at least as I projected, the moves generation and the search needs loops and I tought may be the evaluation could be made without loops but mine use loops too.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: % time moves generator vs. evaluation vs search?

Post by Luis Babboni »

Mmmm.... thinking more, may be using loops for evaluation each time the moves generator and search loops arrives to some position means not aceptable amount of time for evaluation. :?
User avatar
stegemma
Posts: 859
Joined: Mon Aug 10, 2009 10:05 pm
Location: Italy
Full name: Stefano Gemma

Re: % time moves generator vs. evaluation vs search?

Post by stegemma »

Luis Babboni wrote:Hi people.

(As always my question could be nonsense cause my zero background in this matter).

Is correct to say that the moves generator; the evaluation and the search get differents amounts of the total time an engine uses to think?
If is the case, is possible to say around how many in % each one use to consume in a typical engine?

Thanks.
Yes, they get different times or better any part of any program needs some time to complete. In a single processor environment, the % of time of any part depends on the implementation of that part, so it is different from engine to engine. To know the % of any part, you can use a profiler (but you can do it only on the source code). For sample, my engine spends about 88% of the time in alphabeta (the search) distributed this way:

57,5% make moves
11,9% evaluate
6,4% testing move legality (this part is slow, on my engine)
6,1% other

Other program,s as said, have different values.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: % time moves generator vs. evaluation vs search?

Post by Luis Babboni »

Grazie Stefano!

If I´m right, the better way is to just evaluate the position after the last ply "simulated", I´m right?

That is in just 3 ply deep analyze:
1-e4 e5
2-Cf3
the engine at whites just evaluate the board after Cf3, but not after e4 nor after e4 e5.

Is like this?