I am now done with the new sorting. It resulted in quite a noticeable speedup overall.
There are now two things I want to do before releasing the next version.
New piece lists
My old piece lists had a problem with promotions. Instead of looping over the positions for a certain piece you had to loop over the piece type plus all the pawn indexes since one of the pawns could have been promoted.
I considered setting a flag if a pawn was promoted to a certain piece to know if looping the pawn indexes was nescessary. But this is a rather crude workaround.
Instead I am going to create a real list for every piece type. If a pawn gets promoted it is removed from the pawns list and added to the corresponding list.
This way we always have all pieces of a certain type available with a minimum of looping.
While the old evaluation works quite ok, I do not really like the structure of it. I am sure it could be done better and faster.
Also the old evaluation is missing penalty for backwards pawns, does not calculate mobility, lacks a good 'pawn race' evaluation and does not consider 'hanging' pieces. It is also still quite common that Mediocre fails to castle, especially in queen pawn openings.
So while implementing those features I am going to take a look at the overall strucutre as well.