]> git.sesse.net Git - stockfish/commitdiff
Revert "Use std::stable_sort() instead of std::sort()"
authorMarco Costalba <mcostalba@gmail.com>
Sun, 11 Oct 2009 08:35:41 +0000 (10:35 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 12 Oct 2009 07:36:23 +0000 (09:36 +0200)
Unfortunatly std::stable_sort() implementation in gcc is
horrendously slow. We have a big performance regression on
Linux systems (-20% !)

So revert the commit and wait to fix the issue in a different
way, perhaps with an our home grown sorting, that should be
comparable in speed with std::sort()

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/move.h
src/movepick.cpp
src/ucioption.cpp

index 03df770dc824eee7849b37be806042fe0015c2d7..672eade6bcb676f4f9751070d2bcbab86f88965d 100644 (file)
@@ -62,7 +62,7 @@ struct MoveStack {
   int score;
 };
 
-// Note that operator< is set up such that std::stable_sort() will sort in descending order
+// Note that operator< is set up such that std::sort() will sort in descending order
 inline bool operator<(const MoveStack& f, const MoveStack& s) { return s.score < f.score; }
 
 
index 0dd44bbd8db54925e035728bea470075fe5004ae..ea435026241f21b72275af2fd0585b35480ff9a8 100644 (file)
@@ -123,7 +123,7 @@ void MovePicker::go_next_phase() {
   case PH_GOOD_CAPTURES:
       lastMove = generate_captures(pos, moves);
       score_captures();
-      std::stable_sort(moves, lastMove);
+      std::sort(moves, lastMove);
       return;
 
   case PH_KILLERS:
@@ -134,7 +134,7 @@ void MovePicker::go_next_phase() {
   case PH_NONCAPTURES:
       lastMove = generate_noncaptures(pos, moves);
       score_noncaptures();
-      std::stable_sort(moves, lastMove);
+      std::sort(moves, lastMove);
       return;
 
   case PH_BAD_CAPTURES:
@@ -142,20 +142,20 @@ void MovePicker::go_next_phase() {
       // to get SEE move ordering.
       curMove = badCaptures;
       lastMove = lastBadCapture;
-      std::stable_sort(badCaptures, lastMove);
+      std::sort(badCaptures, lastMove);
       return;
 
   case PH_EVASIONS:
       assert(pos.is_check());
       lastMove = generate_evasions(pos, moves, pinned);
       score_evasions();
-      std::stable_sort(moves, lastMove);
+      std::sort(moves, lastMove);
       return;
 
   case PH_QCAPTURES:
       lastMove = generate_captures(pos, moves);
       score_captures();
-      std::stable_sort(moves, lastMove);
+      std::sort(moves, lastMove);
       return;
 
   case PH_QCHECKS:
index 6e727954e68095a6896a03ac3fc5f1fbc2a4db74..1b8665546a20297d1047c564db736cec0f7800ea 100644 (file)
@@ -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::stable_sort(vec.begin(), vec.end());
+  std::sort(vec.begin(), vec.end());
 
   for (std::vector<Option>::const_iterator it = vec.begin(); it != vec.end(); ++it)
   {