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

Avoid unnecessary creation of accumulator cache

Saves a (currently) 800 KB allocation and deallocation when running
`eval`, not particularly significant and zero impact on play but not
necessary either.

closes https://github.com/official-stockfish/Stockfish/pull/5201

No functional change
This commit is contained in:
Ciekce 2024-04-29 01:45:56 +01:00 committed by Disservin
parent 5d72032559
commit eb20de36c0
2 changed files with 3 additions and 2 deletions

View file

@ -46,6 +46,7 @@ Bryan Cross (crossbr)
candirufish
Chess13234
Chris Cain (ceebo)
Ciekce
clefrks
Clemens L. (rn5f107s2)
Cody Ho (aesrentai)

View file

@ -100,11 +100,11 @@ Value Eval::evaluate(const Eval::NNUE::Networks& networks,
// Trace scores are from white's point of view
std::string Eval::trace(Position& pos, const Eval::NNUE::Networks& networks) {
auto caches = std::make_unique<Eval::NNUE::AccumulatorCaches>(networks);
if (pos.checkers())
return "Final evaluation: none (in check)";
auto caches = std::make_unique<Eval::NNUE::AccumulatorCaches>(networks);
std::stringstream ss;
ss << std::showpoint << std::noshowpos << std::fixed << std::setprecision(2);
ss << '\n' << NNUE::trace(pos, networks, *caches) << '\n';