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

Speedup moves root list sorting

Instead of a default member by member copy use set_pv()
to copy the useful part of pv[] array and skip the remaining.

This greatly speeds up sorting of root move list !

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2010-12-27 13:29:52 +01:00
parent e8b5420300
commit 30c14fdc95

View file

@ -113,7 +113,9 @@ namespace {
struct RootMove {
RootMove() : nodes(0) { pv_score = non_pv_score = -VALUE_INFINITE; }
RootMove() : nodes(0) { pv_score = non_pv_score = -VALUE_INFINITE; move = pv[0] = MOVE_NONE; }
RootMove(const RootMove& rm) { *this = rm; }
RootMove& operator=(const RootMove& rm); // Skip costly full pv[] copy
// RootMove::operator<() is the comparison function used when
// sorting the moves. A move m1 is considered to be better
@ -125,13 +127,19 @@ namespace {
}
void set_pv(const Move newPv[]);
Move move;
Value pv_score;
Value non_pv_score;
int64_t nodes;
Move pv[PLY_MAX_PLUS_2];
Value pv_score, non_pv_score;
Move move, pv[PLY_MAX_PLUS_2];
};
RootMove& RootMove::operator=(const RootMove& rm) {
pv_score = rm.pv_score; non_pv_score = rm.non_pv_score;
nodes = rm.nodes; move = rm.move;
set_pv(rm.pv);
return *this;
}
void RootMove::set_pv(const Move newPv[]) {
int i = -1;