mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Explicitly zero TT upon resize.
as discussed in issue #1349, the way pages are allocated with calloc might imply some overhead on first write. This overhead can be large and slow down the first search after a TT resize significantly, especially for large TT. Using an explicit clear of the TT on resize fixes this problem. Not implemented, but possibly useful for large TT, is to do this zero-ing using all search threads. Not only would this be faster, it could also lead to a more favorable memory allocation on numa systems with a first touch policy. No functional change.
This commit is contained in:
parent
7d4d3a2c3a
commit
2ba47416cb
1 changed files with 2 additions and 1 deletions
|
@ -41,7 +41,7 @@ void TranspositionTable::resize(size_t mbSize) {
|
|||
clusterCount = newClusterCount;
|
||||
|
||||
free(mem);
|
||||
mem = calloc(clusterCount * sizeof(Cluster) + CacheLineSize - 1, 1);
|
||||
mem = malloc(clusterCount * sizeof(Cluster) + CacheLineSize - 1);
|
||||
|
||||
if (!mem)
|
||||
{
|
||||
|
@ -51,6 +51,7 @@ void TranspositionTable::resize(size_t mbSize) {
|
|||
}
|
||||
|
||||
table = (Cluster*)((uintptr_t(mem) + CacheLineSize - 1) & ~(CacheLineSize - 1));
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue