Skip to content

Commit

Permalink
Avoid unnecessary creation of accumulator cache
Browse files Browse the repository at this point in the history
Saves a (currently) 800 KB allocation and deallocation when running
`eval`, not particularly significant and zero impact on play but not
necessary either.

closes #5201

No functional change
  • Loading branch information
Ciekce authored and Disservin committed May 1, 2024
1 parent 5d72032 commit eb20de3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Bryan Cross (crossbr)
candirufish
Chess13234
Chris Cain (ceebo)
Ciekce
clefrks
Clemens L. (rn5f107s2)
Cody Ho (aesrentai)
Expand Down
4 changes: 2 additions & 2 deletions src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit eb20de3

Please sign in to comment.