mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 00:56:39 +08:00
Use std::stable_sort() instead of std::sort()
Standard does not mandate std::sort() to be stable, so we can have, and actually do have different node count on different platforms. So use the platform independent std::stable_sort() and gain same functionality on any platform (Windows, Unix, Mac OS) and with any compiler (MSVC, gcc or Intel C++). This sort is teoretically slower, but profiling shows only a very minimal drop in performance, probably due to the fact that the set to sort is very small, mainly only captures and with less frequency non-captures, anyhow we are talking of 30-40 moves in the worst average case. Sorting alghortims are build to work on thousands or even milions of elements. With such small sets performance difference seems not noticable. After 999 games at 1+0 Mod vs Orig +234 =523 -242 -3 ELO Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -210,7 +210,7 @@ void print_uci_options() {
|
||||
for (Options::const_iterator it = options.begin(); it != options.end(); ++it)
|
||||
vec.push_back(it->second);
|
||||
|
||||
std::sort(vec.begin(), vec.end());
|
||||
std::stable_sort(vec.begin(), vec.end());
|
||||
|
||||
for (std::vector<Option>::const_iterator it = vec.begin(); it != vec.end(); ++it)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user