1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Remove TranspositionTable::overwrites variable

Doesn't provide useful information and
can cause slowdown with many Threads.

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Joona Kiiski 2010-07-11 20:22:30 +03:00 committed by Marco Costalba
parent 2adbb80b8b
commit 00e86078a5
3 changed files with 3 additions and 26 deletions

View file

@ -738,8 +738,7 @@ namespace {
// Print final search statistics // Print final search statistics
cout << "info nodes " << TM.nodes_searched() cout << "info nodes " << TM.nodes_searched()
<< " nps " << nps() << " nps " << nps()
<< " time " << current_search_time() << " time " << current_search_time() << endl;
<< " hashfull " << TT.full() << endl;
// Print the best move and the ponder move to the standard output // Print the best move and the ponder move to the standard output
if (pv[0] == MOVE_NONE) if (pv[0] == MOVE_NONE)
@ -2154,7 +2153,7 @@ namespace {
dbg_print_hit_rate(); dbg_print_hit_rate();
cout << "info nodes " << TM.nodes_searched() << " nps " << nps() cout << "info nodes " << TM.nodes_searched() << " nps " << nps()
<< " time " << t << " hashfull " << TT.full() << endl; << " time " << t << endl;
} }
// Should we stop the search? // Should we stop the search?

View file

@ -23,7 +23,6 @@
//// ////
#include <cassert> #include <cassert>
#include <cmath>
#include <cstring> #include <cstring>
#include "movegen.h" #include "movegen.h"
@ -38,7 +37,7 @@ TranspositionTable TT;
TranspositionTable::TranspositionTable() { TranspositionTable::TranspositionTable() {
size = overwrites = 0; size = 0;
entries = 0; entries = 0;
generation = 0; generation = 0;
} }
@ -127,7 +126,6 @@ void TranspositionTable::store(const Key posKey, Value v, ValueType t, Depth d,
replace = tte; replace = tte;
} }
replace->save(posKey32, v, t, d, m, generation, statV, kingD); replace->save(posKey32, v, t, d, m, generation, statV, kingD);
overwrites++;
} }
@ -154,9 +152,7 @@ TTEntry* TranspositionTable::retrieve(const Key posKey) const {
/// entries from the current search. /// entries from the current search.
void TranspositionTable::new_search() { void TranspositionTable::new_search() {
generation++; generation++;
overwrites = 0;
} }
@ -212,14 +208,3 @@ void TranspositionTable::extract_pv(const Position& pos, Move bestMove, Move pv[
} }
pv[ply] = MOVE_NONE; pv[ply] = MOVE_NONE;
} }
/// TranspositionTable::full() returns the permill of all transposition table
/// entries which have received at least one overwrite during the current search.
/// It is used to display the "info hashfull ..." information in UCI.
int TranspositionTable::full() const {
double N = double(size) * ClusterSize;
return int(1000 * (1 - exp(overwrites * log(1.0 - 1.0/N))));
}

View file

@ -113,16 +113,9 @@ public:
void new_search(); void new_search();
void insert_pv(const Position& pos, Move pv[]); void insert_pv(const Position& pos, Move pv[]);
void extract_pv(const Position& pos, Move bestMove, Move pv[], const int PLY_MAX); void extract_pv(const Position& pos, Move bestMove, Move pv[], const int PLY_MAX);
int full() const;
TTEntry* first_entry(const Key posKey) const; TTEntry* first_entry(const Key posKey) const;
private: private:
// Be sure 'overwrites' is at least one cache line away
// from read only variables.
unsigned char pad_before[64 - sizeof(unsigned)];
unsigned overwrites; // heavy SMP read/write access here
unsigned char pad_after[64];
size_t size; size_t size;
TTCluster* entries; TTCluster* entries;
uint8_t generation; uint8_t generation;