I'm using power-of-two masks in Pygmalion currently, but I do consider to changing that in a way to support arbitrary sizes. I somehow doubt it's possible to have these to be compile-time constants if you intend to make that a parameter that can be configured via some GUI. However I doubt it's that much of an impact: for me the really time consuming part when doing TT lookups is to check the legality of the TT move, which overshadows any gain from such tweaks by orders of magnitude.klx wrote: ↑Thu Sep 30, 2021 5:52 pmHave you checked what your code does?mvanthoor wrote: ↑Thu Sep 30, 2021 5:45 pm That is what I mean with bit-shifting indeed, and I tried it manually because that was a performance tip I found somewhere. It may have worked in the past, but current-day compilers can do this on their own. Therefore I don't try these micro-optimizations anymore.
Looks to me like the divisor is not known or easily deduced compile time, so I doubt the compiler can fix this one for you.Code: Select all
(key % (self.total_entries as u64)) as usize
Edit: Actually, when profiling with vTune, the legality check of TT moves is the hottest part of my code (like about 30% time is spent there).