Incremental update of PST values slower than not incremental?

Discussion of chess software programming and technical issues.

Moderator: Ras

JVMerlino
Posts: 1396
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Incremental update of PST values slower than not incremental?

Post by JVMerlino »

Rebel wrote: Fri May 12, 2023 7:40 pm
JVMerlino wrote: Thu May 11, 2023 1:22 am Finally got around to converting the PST portion of my eval to be incrementally updated with make/unmake, rather than doing it all from scratch whenever Evaluate() is called. And my engine is now about 10% slower.... :(
When you do a depth=x search, do the old and new version produce the same number of nodes searched?
They do. Same nodes, same score, same PV.
JoAnnP38
Posts: 253
Joined: Mon Aug 26, 2019 4:34 pm
Location: Clearwater, Florida USA
Full name: JoAnn Peeler

Re: Incremental update of PST values slower than not incremental?

Post by JoAnnP38 »

PK wrote: Fri May 12, 2023 9:34 am C# multi dimensional tables are slow. Use some function to generate an index to a one-dimensional array, something like return 64 * (6 * x + y) + z; this will help both with incremental and non-incremental tables, and perhaps it will shift the proportion between one and the other.
Agreed, that why I use my own class UnsafeArray2D<T> which uses fixed memory and pointer to access the array and I have to do the index arithmetic myself. I just used the multi-dim indexer because that's what C# allows you to overload. Unfortunately, while this benchmarks out fantastic, in actual use a lot of time is spent invalidating the cache when very large lookup tables which starts to dwarf .NET's array indexing and bounds check overhead. Amdahl's law bites me in the rearend again! I hate that guy!
syzygy
Posts: 5694
Joined: Tue Feb 28, 2012 11:56 pm

Re: Incremental update of PST values slower than not incremental?

Post by syzygy »

[comment removed because I mistook the person to whom I responded for the TS]