]> git.sesse.net Git - stockfish/commitdiff
Avoid unnecessary string copies
authorSebastian Buchwald <UniQP@web.de>
Fri, 6 Jan 2023 17:13:21 +0000 (18:13 +0100)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Mon, 9 Jan 2023 19:32:58 +0000 (20:32 +0100)
closes https://github.com/official-stockfish/Stockfish/pull/4326

also fixes typo, closes https://github.com/official-stockfish/Stockfish/pull/4332

No functional change

src/evaluate.cpp
src/nnue/layers/sqr_clipped_relu.h
src/uci.cpp

index 3aae9f1c6ec3d337d5a9c953e5e528cf3a341439..6db977a4c7e2c636c82b4417b423daf0c2203470 100644 (file)
@@ -89,7 +89,7 @@ namespace Eval {
     vector<string> dirs = { "<internal>" , "" , CommandLine::binaryDirectory };
     #endif
 
-    for (string directory : dirs)
+    for (const string& directory : dirs)
         if (currentEvalFileName != eval_file)
         {
             if (directory != "<internal>")
index df539b39164967178c59970cf22cae690847cc07..3fbb243cfd6c38371183e8ebec459f822fa01cb6 100644 (file)
@@ -106,7 +106,7 @@ namespace Stockfish::Eval::NNUE::Layers {
 
       for (IndexType i = Start; i < InputDimensions; ++i) {
         output[i] = static_cast<OutputType>(
-            // realy should be /127 but we need to make it fast
+            // really should be /127 but we need to make it fast
             // needs to be accounted for in the trainer
             std::max(0ll, std::min(127ll, (((long long)input[i] * input[i]) >> (2 * WeightScaleBits)) / 128)));
       }
index eb158e723e4e37d2d6b9c71e15d2002099165dd2..30c1fa0cce0cfc448dc4cf96ae78684c324f4a0e 100644 (file)
@@ -160,7 +160,7 @@ namespace {
     uint64_t num, nodes = 0, cnt = 1;
 
     vector<string> list = setup_bench(pos, args);
-    num = count_if(list.begin(), list.end(), [](string s) { return s.find("go ") == 0 || s.find("eval") == 0; });
+    num = count_if(list.begin(), list.end(), [](const string& s) { return s.find("go ") == 0 || s.find("eval") == 0; });
 
     TimePoint elapsed = now();