The Quality of Caching and Hash Keys
Posted: 07 Dec 2004, 10:11
Hi all,
because Uri Blass remembered me to publish some thoughts on caching I will try to start a serious dicussion on that again. But because of it would not make much sense to only philosophically talk about different ideas around that theme it seems to be good to have an objectivating test scenario to proof ideas and stategies.
It has always been said that hash collisions would be generated only rarely and therefore simply could be ignored. This is a very bad idea if wanting to test, whether more or less collisions will happen depending on different key creating strategies.
Additionally different replacement schemes could be compared very badly, because of mostly being embedded in different search tree pruning ideas etc..
Both aspects could be objectivly tested when using an approach to calculate perft values storing position results into the cache using the program typical key generating and replacement scheme. If there would be hash collisions the results would differ especially in higher plys. If the replacement scheme would have a good quality, the speed of generating results would be high.
I have posted such Smirf results several times, but never ever seen comparable figures. May be that could be changed if you are interested in comparing your caching to mine.
Reinhard.
because Uri Blass remembered me to publish some thoughts on caching I will try to start a serious dicussion on that again. But because of it would not make much sense to only philosophically talk about different ideas around that theme it seems to be good to have an objectivating test scenario to proof ideas and stategies.
It has always been said that hash collisions would be generated only rarely and therefore simply could be ignored. This is a very bad idea if wanting to test, whether more or less collisions will happen depending on different key creating strategies.
Additionally different replacement schemes could be compared very badly, because of mostly being embedded in different search tree pruning ideas etc..
Both aspects could be objectivly tested when using an approach to calculate perft values storing position results into the cache using the program typical key generating and replacement scheme. If there would be hash collisions the results would differ especially in higher plys. If the replacement scheme would have a good quality, the speed of generating results would be high.
I have posted such Smirf results several times, but never ever seen comparable figures. May be that could be changed if you are interested in comparing your caching to mine.
Reinhard.
- Code: Select all
FEN: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
+-*--b--c--d--*--f--g--*-+ MS Vis. Studio C++ Vers. 13.10
8 |[r][n][b][q][k][b][n][r]| (Compilation: Nov 24 2004)
7 |[p][p][p][p][p][p][p][p]|
6 | ::: ::: ::: :::| Perft Testseries
5 |::: ::: ::: ::: | (With TT Caching 256.0 MB / 4-fold)
4 | ::: ::: ::: :::| TT Access Success 48.3%
3 |::: ::: ::: ::: |
2 |<P><P><P><P><P><P><P><P>| Smirf Test No.: 00
1 |<R><N><B><Q><K><B><N><R>|
=>+-*--b--c--d--*--f--g--*-+ Break Time 32.0 Sec.
Ply Nodes all (x) all (+) Castl. Sec.
----------------------------------------------------------------------------
1 20 0 0 0 0
2 400 0 0 0 0
3 8902 34 12 0 0
4 197281 1576 469 0 0
5 4865609 82719 27351 0 0.1
6 119060324 2812008 809099 0 1.3
7 3195901860 108329926 33103848 883453 16.1
8 84998978956 3523740106 968981593 23605205 226.1
----------------------------------------------------------------------------
FEN: r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 25
+-*--b--c--d--*--f--g--*-+ MS Vis. Studio C++ Vers. 13.10
8 |[r]::: :::[k]::: [r]| (Compilation: Nov 24 2004)
7 |[p] [p][p][q][p][b] |
6 |[b][n] :::[p][n][p]:::| Perft Testseries
5 |::: :::<P><N> ::: | (With TT Caching 256.0 MB / 4-fold)
4 | [p] :::<P>::: :::| TT Access Success 50.7%
3 |::: <N> :::<Q>:::[p]|
2 |<P><P><P><B><B><P><P><P>| Smirf Test No.: 01
1 |<R> ::: <K> :::<R>|
=>+-*--b--c--d--*--f--g--*-+ Break Time 32.0 Sec.
Ply Nodes all (x) all (+) Castl. Sec.
----------------------------------------------------------------------------
1 48 8 0 2 0
2 2039 351 3 91 0
3 97862 17102 993 3162 0
4 4085603 757163 25523 128013 0.1
5 193690690 35043416 3309887 4993637 3.2
6 8031647685 1558445089 92238050 184513607 75.8
----------------------------------------------------------------------------
FEN: 8/PPP4k/8/8/8/8/4Kppp/8 w - - 0 1
+-a--b--c--d--e--f--g--h-+ MS Vis. Studio C++ Vers. 13.10
8 | ::: ::: ::: :::| (Compilation: Nov 24 2004)
7 |<P><P><P> ::: :::[k]|
6 | ::: ::: ::: :::| Perft Testseries
5 |::: ::: ::: ::: | (With TT Caching 256.0 MB / 4-fold)
4 | ::: ::: ::: :::| TT Access Success 61.2%
3 |::: ::: ::: ::: |
2 | ::: :::<K>[p][p][p]| Smirf Test No.: 02
1 |::: ::: ::: ::: |
=>+-a--b--c--d--e--f--g--h-+ Break Time 32.0 Sec.
Ply Nodes all (x) all (+) Castl. Sec.
----------------------------------------------------------------------------
1 18 1 0 0 0
2 290 0 52 0 0
3 5044 144 310 0 0
4 89363 194 15360 0 0
5 1745545 46745 161249 0 0.1
6 34336777 406616 6021556 0 0.5
7 749660761 22632801 87618216 0 5.2
8 16303466487 337063298 2990354989 0 47.9
----------------------------------------------------------------------------
FEN: 8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 1
+-a--b--c--d--e--f--g--h-+ MS Vis. Studio C++ Vers. 13.10
8 | ::: ::: ::: :::| (Compilation: Nov 24 2004)
7 |::: [p] ::: ::: |
6 | ::: [p] ::: :::| Perft Testseries
5 |<K><P>::: ::: :::[r]| (With TT Caching 256.0 MB / 4-fold)
4 | <R> ::: [p] [k]| TT Access Success 69.7%
3 |::: ::: ::: ::: |
2 | ::: :::<P>:::<P>:::| Smirf Test No.: 03
1 |::: ::: ::: ::: |
=>+-a--b--c--d--e--f--g--h-+ Break Time 32.0 Sec.
Ply Nodes all (x) all (+) Castl. Sec.
----------------------------------------------------------------------------
1 14 1 2 0 0
2 191 14 10 0 0
3 2812 209 267 0 0
4 43238 3348 1680 0 0
5 674624 52051 52950 0 0
6 11030083 940350 452473 0 0.2
7 178633661 14519036 12797406 0 1.2
8 3009794393 267586558 135626805 0 7.5
9 50086749815 4208748290 3440345177 0 42.6
----------------------------------------------------------------------------
FEN: 8/3K4/2p5/p2b2r1/5k2/8/8/1q6 b - - 1 67
=>+-a--b--c--d--e--f--g--h-+ MS Vis. Studio C++ Vers. 13.10
8 | ::: ::: ::: :::| (Compilation: Nov 24 2004)
7 |::: :::<K>::: ::: |
6 | :::[p]::: ::: :::| Perft Testseries
5 |[p] :::[b]::: [r] | (With TT Caching 256.0 MB / 4-fold)
4 | ::: ::: [k] :::| TT Access Success 74.2%
3 |::: ::: ::: ::: |
2 | ::: ::: ::: :::| Smirf Test No.: 04
1 |:::[q]::: ::: ::: |
+-a--b--c--d--e--f--g--h-+ Break Time 32.0 Sec.
Ply Nodes all (x) all (+) Castl. Sec.
----------------------------------------------------------------------------
1 50 0 5 0 0
2 279 7 0 0 0
3 13310 0 1465 0 0
4 54703 1417 0 0 0
5 2538084 0 303975 0 0
6 10809689 391329 0 0 0.2
7 493407574 0 58927342 0 0.8
8 2074492344 76527631 0 0 4.2
9 93718646102 0 11464464778 0 11.5
0 397773803207 15954546937 0 0 55.3
----------------------------------------------------------------------------
FEN: 8/7p/p5pb/4k3/P1pPn3/8/P5PP/1rB2RK1 b - d3 0 28
=>+-a--b--c--d--e--f--g--h-+ MS Vis. Studio C++ Vers. 13.10
8 | ::: ::: ::: :::| (Compilation: Nov 24 2004)
7 |::: ::: ::: :::[p]|
6 |[p]::: ::: :::[p][b]| Perft Testseries
5 |::: ::: [k] ::: | (With TT Caching 256.0 MB / 4-fold)
4 |<P>:::[p]<P>[n]::: :::| TT Access Success 55.9%
3 |::: ::: * ::: ::: |
2 |<P>::: ::: :::<P><P>| Smirf Test No.: 05
1 |:::[r]<B> :::<R><K> |
+-a--b--c--d--e--f--g--h-+ Break Time 32.0 Sec.
Ply Nodes all (x) all (+) Castl. Sec.
----------------------------------------------------------------------------
1 5 2 0 0 0
2 117 5 12 0 0
3 3293 269 148 0 0
4 67197 4279 6019 0 0
5 1881089 151494 99957 0 0.1
6 38633283 2758216 3357855 0 0.8
7 1069189070 85602380 58008914 0 8.8
8 22488501780 1700604632 1927497345 0 90.5
----------------------------------------------------------------------------
FEN: rnbqkb1r/ppppp1pp/7n/4Pp2/8/8/PPPP1PPP/RNBQKBNR w KQkq f6 0 3
+-*--b--c--d--*--f--g--*-+ MS Vis. Studio C++ Vers. 13.10
8 |[r][n][b][q][k][b] [r]| (Compilation: Nov 24 2004)
7 |[p][p][p][p][p] [p][p]|
6 | ::: ::: :*: [n]| Perft Testseries
5 |::: ::: <P>[p]::: | (With TT Caching 256.0 MB / 4-fold)
4 | ::: ::: ::: :::| TT Access Success 51.4%
3 |::: ::: ::: ::: |
2 |<P><P><P><P> <P><P><P>| Smirf Test No.: 06
1 |<R><N><B><Q><K><B><N><R>|
=>+-*--b--c--d--*--f--g--*-+ Break Time 32.0 Sec.
Ply Nodes all (x) all (+) Castl. Sec.
----------------------------------------------------------------------------
1 31 1 1 0 0
2 570 9 0 0 0
3 17546 411 598 0 0
4 351806 13979 704 0 0
5 11139762 460500 391791 8622 0.2
6 244063299 14386441 1831869 181851 3.0
7 7930902498 458901248 289376682 12288205 36.7
----------------------------------------------------------------------------
FEN: rnbqckabnr/pppppppppp/0/0/0/0/PPPPPPPPPP/RNBQCKABNR w KQkq - 0 1
+-*--b--c--d--e--*--g--h--i--*-+ MS Vis. Studio C++ Vers. 13.10
8 |[r][n][b][q][c][k][a][b][n][r]| (Compilation: Nov 24 2004)
7 |[p][p][p][p][p][p][p][p][p][p]|
6 | ::: ::: ::: ::: :::| Perft Testseries
5 |::: ::: ::: ::: ::: | (With TT Caching 256.0 MB / 4-fold)
4 | ::: ::: ::: ::: :::| TT Access Success 53.4%
3 |::: ::: ::: ::: ::: |
2 |<P><P><P><P><P><P><P><P><P><P>| Smirf Test No.: 07
1 |<R><N><B><Q><C><K><A><B><N><R>|
=>+-*--b--c--d--e--*--g--h--i--*-+ Break Time 32.0 Sec.
Ply Nodes all (x) all (+) Castl. Sec.
----------------------------------------------------------------------------
1 28 0 0 0 0
2 784 0 0 0 0
3 25283 387 120 0 0
4 808984 14812 4019 0 0
5 28946187 907953 304360 0 0.5
6 1025229212 36740962 11052055 0 8.7
7 39532257395 1838308392 621202264 120 149.8
----------------------------------------------------------------------------
FEN: r1b1c2rk1/p4a1ppp/1ppq2pn2/3p1p4/3A1Pn3/1PN3PN2/P1PQP1BPPP/3RC2RK1 w - - 0 15
+-a--b--c--d--e--f--g--h--i--j-+ MS Vis. Studio C++ Vers. 13.10
8 |[r]:::[b]:::[c]::: [r][k]:::| (Compilation: Nov 24 2004)
7 |[p] ::: :::[a]:::[p][p][p]|
6 | [p][p][q] :::[p][n] :::| Perft Testseries
5 |::: :::[p]:::[p]::: ::: | (With TT Caching 256.0 MB / 4-fold)
4 | ::: <A> <P>[n]::: :::| TT Access Success 43.3%
3 |:::<P><N> ::: <P><N>::: |
2 |<P>:::<P><Q><P>:::<B><P><P><P>| Smirf Test No.: 08
1 |::: :::<R><C> :::<R><K> |
=>+-a--b--c--d--e--f--g--h--i--j-+ Break Time 32.0 Sec.
Ply Nodes all (x) all (+) Castl. Sec.
----------------------------------------------------------------------------
1 50 6 1 0 0
2 2801 191 2 0 0
3 143032 18799 2215 0 0
4 7917813 680548 45116 0 0.2
5 412224167 56838308 5549854 0 5.2
6 22846373778 2289332857 218647805 0 163.4
----------------------------------------------------------------------------
FEN: r1b2k2nr/p1ppq1ppbp/n1Pcpa2p1/5p4/5P4/1p1PBCPN2/PP1QP1BPPP/RN3KA2R w KQkq - 6 12
+-*--b--c--d--e--*--g--h--i--*-+ MS Vis. Studio C++ Vers. 13.10
8 |[r]:::[b]::: [k] :::[n][r]| (Compilation: Nov 24 2004)
7 |[p] [p][p][q] [p][p][b][p]|
6 |[n]:::<P>[c][p][a] :::[p]:::| Perft Testseries
5 |::: ::: :::[p]::: ::: | (With TT Caching 256.0 MB / 4-fold)
4 | ::: ::: <P> ::: :::| TT Access Success 48.6%
3 |:::[p]:::<P><B><C><P><N>::: |
2 |<P><P> <Q><P>:::<B><P><P><P>| Smirf Test No.: 09
1 |<R><N>::: :::<K><A> :::<R>|
=>+-*--b--c--d--e--*--g--h--i--*-+ Break Time 32.0 Sec.
Ply Nodes all (x) all (+) Castl. Sec.
----------------------------------------------------------------------------
1 41 3 0 0 0
2 2107 292 5 0 0
3 93962 9434 1258 146 0
4 4869569 732934 71559 5375 0.1
5 228645312 27763729 5362814 538292 3.5
6 11962047524 1912281008 278541908 21162954 99.9
----------------------------------------------------------------------------