mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 13:17:44 +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:
@@ -46,6 +46,7 @@ Bryan Cross (crossbr)
|
|||||||
candirufish
|
candirufish
|
||||||
Chess13234
|
Chess13234
|
||||||
Chris Cain (ceebo)
|
Chris Cain (ceebo)
|
||||||
|
Ciekce
|
||||||
clefrks
|
clefrks
|
||||||
Clemens L. (rn5f107s2)
|
Clemens L. (rn5f107s2)
|
||||||
Cody Ho (aesrentai)
|
Cody Ho (aesrentai)
|
||||||
|
|||||||
+2
-2
@@ -100,11 +100,11 @@ Value Eval::evaluate(const Eval::NNUE::Networks& networks,
|
|||||||
// Trace scores are from white's point of view
|
// Trace scores are from white's point of view
|
||||||
std::string Eval::trace(Position& pos, const Eval::NNUE::Networks& networks) {
|
std::string Eval::trace(Position& pos, const Eval::NNUE::Networks& networks) {
|
||||||
|
|
||||||
auto caches = std::make_unique<Eval::NNUE::AccumulatorCaches>(networks);
|
|
||||||
|
|
||||||
if (pos.checkers())
|
if (pos.checkers())
|
||||||
return "Final evaluation: none (in check)";
|
return "Final evaluation: none (in check)";
|
||||||
|
|
||||||
|
auto caches = std::make_unique<Eval::NNUE::AccumulatorCaches>(networks);
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << std::showpoint << std::noshowpos << std::fixed << std::setprecision(2);
|
ss << std::showpoint << std::noshowpos << std::fixed << std::setprecision(2);
|
||||||
ss << '\n' << NNUE::trace(pos, networks, *caches) << '\n';
|
ss << '\n' << NNUE::trace(pos, networks, *caches) << '\n';
|
||||||
|
|||||||
Reference in New Issue
Block a user