Thanks to whose who answered to my question , especially thanks to Bo Persson who take his time to look at my (so bad
Seems I have a lot of work to do !
Best
Dany
Moderator: Ras
Small nitpick: it's almost never necessary to help the compiler by providing explicit template arguments. You can and should rely on template argument deduction by writingPatrice Duhamel wrote: ↑Thu Feb 11, 2021 6:38 pm Using compiler explorer (I don't have latest MSVC installed), it seems MSVC add a test for popcount, and other <bit> functions.
Code: Select all
int bitcount(uint64_t b) { return std::popcount<uint64_t>(b); }
Code: Select all
int bitcount(uint64_t b)
{
return std::popcount(b); // b is of type uint64_t and the compiler will select the right template instantiation
}
There have been a gazillion of threads about this topic in the past. In the most recent one I remember, from few weeks ago, I have explained once more why writing an "almost fully legal move generator" is simple and does not decrease overall performance.mvanthoor wrote: ↑Thu Feb 11, 2021 8:55 pmThat is just the ting; my move generator is also pseudo-legal. To be able to bulk-count, I would therefore have to move the is-in-check function from make_move to the move generator; then it will become fully legal, but this is bad for chess performance.
I could add it into the move generator, and then make both of them mutually exclusive; use the is-in-check in the move generator when running perft, and use the one in make_move when playing games. That feels like a hack though.
Creating a fully legal move generator by not generating illegal moves (by detecting pinned pieces and such) is an enhancement I wish to keep for a (much) later date.
Maybe If you do only piece square evaluation then movegeneration slows down performance.
Daniel Anulliero wrote: ↑Fri Feb 12, 2021 12:37 am Hi
Thanks to whose who answered to my question , especially thanks to Bo Persson who take his time to look at my (so bad) code and his more detailled answer
Seems I have a lot of work to do !
Best
Dany
I agree with H.G.Also note that in many engines the large majority of time is spent in evaluation. So even a bulk-counting perft, which is a good measure for how fast the move generation + move making in the engine takes, can be sped up a factor 2, while the engine then only benefits 5%. Because 90% of the time it was doing other things. Like move sorting or evaluation.
I agree with federico, this is a key question. If you are mimicking search logic then I'd say your perft speed is a little slow but not too bad. If you're not mimicking search logic- meaning you've optimized perft solely to generate and count legal moves- then your perft speed is slow.federico wrote: ↑Fri Feb 12, 2021 3:06 pm Which leads to me the following... Does your move generator do anything else aside from actually generating the moves ? Like scoring , ordering, complex move encoding or anything like that ? , which may contribute to making it slower than expected, other than the actual move generator?