R. Tomasi wrote: ↑Sat Sep 18, 2021 3:36 pm
EDIT: have you tried comparing the verbatim code that I posted on your machine? My Laptop might really be a suboptimal system for testing such things.
With the verbatim code I could indeed measure a small improvement when doing the LSB fix. I have then made a crude mix of my changes and your changes and this mix completes the testsuite in less than 40s where the vanilla version took more than 60s. So it's pretty fast and a step in the right direction. But when I remove the LSB optimizations now it doesn't really make a difference or rather the difference it makes seems to drown in the measurment variance. At this point, when in doubt I'd rather pick whatever is closer to the original C version.
Here are some measurements. Sadly I didn't keep the earlier ones around but they were pretty much the same:
Calling LSB twice in move gen without a temporary variable to store the LSB result:
Code: Select all
PS D:\Projekte\Chess\QBB\QBB-Perft\bin\Release\net5.0\publish\1.2 RTomasi no LSB Fix> .\qbb_perft.exe
QBB Perft in C#
https://github.com/lithander/QBB-Perft/tree/v1.2
OK! 3667ms, 32467K NPS
OK! 5200ms, 37245K NPS
OK! 5923ms, 30154K NPS
OK! 19761ms, 35727K NPS
OK! 1ms, 34179K NPS
OK! 4415ms, 37156K NPS
Total Time: 38970 ms
Press any key to quit
PS D:\Projekte\Chess\QBB\QBB-Perft\bin\Release\net5.0\publish\1.2 RTomasi no LSB Fix> .\qbb_perft.exe
QBB Perft in C#
https://github.com/lithander/QBB-Perft/tree/v1.2
OK! 3674ms, 32403K NPS
OK! 5197ms, 37263K NPS
OK! 5989ms, 29826K NPS
OK! 19918ms, 35446K NPS
OK! 1ms, 33781K NPS
OK! 4428ms, 37050K NPS
Total Time: 39209 ms
Press any key to quit
PS D:\Projekte\Chess\QBB\QBB-Perft\bin\Release\net5.0\publish\1.2 RTomasi no LSB Fix> .\qbb_perft.exe
QBB Perft in C#
https://github.com/lithander/QBB-Perft/tree/v1.2
OK! 3705ms, 32132K NPS
OK! 5183ms, 37368K NPS
OK! 6031ms, 29614K NPS
OK! 19917ms, 35448K NPS
OK! 1ms, 33704K NPS
OK! 4405ms, 37241K NPS
Total Time: 39245 ms
Press any key to quit
PS D:\Projekte\Chess\QBB\QBB-Perft\bin\Release\net5.0\publish\1.2 RTomasi no LSB Fix> .\qbb_perft.exe
QBB Perft in C#
https://github.com/lithander/QBB-Perft/tree/v1.2
OK! 3645ms, 32663K NPS
OK! 5178ms, 37402K NPS
OK! 5916ms, 30191K NPS
OK! 19682ms, 35871K NPS
OK! 1ms, 32868K NPS
OK! 4386ms, 37403K NPS
Total Time: 38811 ms
Press any key to quit
PS D:\Projekte\Chess\QBB\QBB-Perft\bin\Release\net5.0\publish\1.2 RTomasi no LSB Fix> .\qbb_perft.exe
QBB Perft in C#
https://github.com/lithander/QBB-Perft/tree/v1.2
OK! 3681ms, 32336K NPS
OK! 5213ms, 37150K NPS
OK! 5940ms, 30071K NPS
OK! 20017ms, 35270K NPS
OK! 1ms, 33508K NPS
OK! 4512ms, 36362K NPS
Total Time: 39367 ms
Press any key to quit
PS D:\Projekte\Chess\QBB\QBB-Perft\bin\Release\net5.0\publish\1.2 RTomasi no LSB Fix> .\qbb_perft.exe
QBB Perft in C#
https://github.com/lithander/QBB-Perft/tree/v1.2
OK! 3644ms, 32671K NPS
OK! 5175ms, 37421K NPS
OK! 5780ms, 30901K NPS
OK! 19612ms, 35999K NPS
OK! 1ms, 33035K NPS
OK! 4391ms, 37360K NPS
Total Time: 38606 ms
With the LSB fix (the move gen related code is exactly like you posted it)
Code: Select all
PS D:\Projekte\Chess\QBB\QBB-Perft\bin\Release\net5.0\publish\1.2 RTomasi> .\qbb_perft.exe
QBB Perft in C#
https://github.com/lithander/QBB-Perft/tree/v1.2
OK! 3724ms, 31963K NPS
OK! 5281ms, 36676K NPS
OK! 6004ms, 29751K NPS
OK! 20103ms, 35120K NPS
OK! 1ms, 33741K NPS
OK! 4403ms, 37262K NPS
Total Time: 39518 ms
Press any key to quit
PS D:\Projekte\Chess\QBB\QBB-Perft\bin\Release\net5.0\publish\1.2 RTomasi> .\qbb_perft.exe
QBB Perft in C#
https://github.com/lithander/QBB-Perft/tree/v1.2
OK! 3704ms, 32143K NPS
OK! 5303ms, 36517K NPS
OK! 6026ms, 29641K NPS
OK! 20211ms, 34933K NPS
OK! 1ms, 33666K NPS
OK! 4436ms, 36979K NPS
Total Time: 39684 ms
Press any key to quit
PS D:\Projekte\Chess\QBB\QBB-Perft\bin\Release\net5.0\publish\1.2 RTomasi> .\qbb_perft.exe
QBB Perft in C#
https://github.com/lithander/QBB-Perft/tree/v1.2
OK! 3672ms, 32416K NPS
OK! 5194ms, 37286K NPS
OK! 5803ms, 30780K NPS
OK! 19807ms, 35644K NPS
OK! 1ms, 34107K NPS
OK! 4357ms, 37657K NPS
Total Time: 38837 ms
Press any key to quit
PS D:\Projekte\Chess\QBB\QBB-Perft\bin\Release\net5.0\publish\1.2 RTomasi> .\qbb_perft.exe
QBB Perft in C#
https://github.com/lithander/QBB-Perft/tree/v1.2
OK! 3679ms, 32358K NPS
OK! 5211ms, 37162K NPS
OK! 5852ms, 30523K NPS
OK! 19833ms, 35598K NPS
OK! 1ms, 33951K NPS
OK! 4441ms, 36939K NPS
Total Time: 39020 ms
Press any key to quit
PS D:\Projekte\Chess\QBB\QBB-Perft\bin\Release\net5.0\publish\1.2 RTomasi> .\qbb_perft.exe
QBB Perft in C#
https://github.com/lithander/QBB-Perft/tree/v1.2
OK! 3753ms, 31718K NPS
OK! 5306ms, 36500K NPS
OK! 6094ms, 29310K NPS
OK! 20310ms, 34762K NPS
OK! 1ms, 32348K NPS
OK! 4490ms, 36539K NPS
Total Time: 39957 ms
Press any key to quit
PS D:\Projekte\Chess\QBB\QBB-Perft\bin\Release\net5.0\publish\1.2 RTomasi> .\qbb_perft.exe
QBB Perft in C#
https://github.com/lithander/QBB-Perft/tree/v1.2
OK! 3759ms, 31670K NPS
OK! 5289ms, 36621K NPS
OK! 5856ms, 30504K NPS
OK! 20061ms, 35194K NPS
OK! 1ms, 33726K NPS
OK! 4460ms, 36787K NPS
Total Time: 39427 ms
Press any key to quit