From ececde15e6270a277403b74b96c67240ac0ca2b4 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Tue, 26 Dec 2023 01:46:50 +0800 Subject: [PATCH] prefect: Optimize Comment for Clarity on Performance Concerns This commit updates the comment preceding the deinitializeIfNeeded() call in the getBestMove function. The revised comment more clearly articulates the performance implications of frequent initialization and deinitialization in a performance-sensitive environment. It emphasizes the need for a more efficient approach to managing initialization cycles, thereby guiding future optimizations and code maintenance efforts. Reference: https://github.com/ggevay/malom/pull/3#discussion_r1349745071 Change-Id: I0f8ed192d5a40f2485d7e7819c42e553c265909f --- src/perfect/perfect_api.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/perfect/perfect_api.cpp b/src/perfect/perfect_api.cpp index e78957212..098eb9e30 100644 --- a/src/perfect/perfect_api.cpp +++ b/src/perfect/perfect_api.cpp @@ -104,6 +104,14 @@ int MalomSolutionAccess::getBestMove(int whiteBitboard, int blackBitboard, "from the starting position."); } + // TODO: Considering the performance-critical aspect of our applications, + // it is advised to reconsider the frequent invocation of + // deinitializeIfNeeded() within each getBestMove call. Such a practice + // necessitates the re-initialization by initializeIfNeeded() at every + // function start, leading to significant performance overheads. An + // optimized approach for initialization and deinitialization processes + // should be explored to mitigate these costs. + // https://github.com/ggevay/malom/pull/3#discussion_r1349745071 deinitializeIfNeeded(); return ret;