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>
-// 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; }
inline bool operator<(const MoveStack& f, const MoveStack& s) { return s.score < f.score; }
case PH_GOOD_CAPTURES:
lastMove = generate_captures(pos, moves);
score_captures();
case PH_GOOD_CAPTURES:
lastMove = generate_captures(pos, moves);
score_captures();
- std::stable_sort(moves, lastMove);
+ std::sort(moves, lastMove);
case PH_NONCAPTURES:
lastMove = generate_noncaptures(pos, moves);
score_noncaptures();
case PH_NONCAPTURES:
lastMove = generate_noncaptures(pos, moves);
score_noncaptures();
- std::stable_sort(moves, lastMove);
+ std::sort(moves, lastMove);
return;
case PH_BAD_CAPTURES:
return;
case PH_BAD_CAPTURES:
// to get SEE move ordering.
curMove = badCaptures;
lastMove = lastBadCapture;
// 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();
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();
return;
case PH_QCAPTURES:
lastMove = generate_captures(pos, moves);
score_captures();
- std::stable_sort(moves, lastMove);
+ std::sort(moves, lastMove);
for (Options::const_iterator it = options.begin(); it != options.end(); ++it)
vec.push_back(it->second);
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)
{
for (std::vector<Option>::const_iterator it = vec.begin(); it != vec.end(); ++it)
{