Code: Select all
Marcel@WORKSTATION MINGW64 /c/Code/weiss/src
$ ./weiss-dev.exe
perft 7 rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
Starting perft to depth 7
move 1 : a2a3 : 106743106
move 2 : b2b3 : 133233975
move 3 : c2c3 : 144074944
move 4 : d2d3 : 227598692
move 5 : e2e3 : 306138410
move 6 : f2f3 : 102021008
move 7 : g2g3 : 135987651
move 8 : h2h3 : 106678423
move 9 : a2a4 : 137077337
move 10 : b2b4 : 134087476
move 11 : c2c4 : 157756443
move 12 : d2d4 : 269605599
move 13 : e2e4 : 309478263
move 14 : f2f4 : 119614841
move 15 : g2g4 : 130293018
move 16 : h2h4 : 138495290
move 17 : b1a3 : 120142144
move 18 : b1c3 : 148527161
move 19 : g1f3 : 147678554
move 20 : g1h3 : 120669525
Perft complete:
Time : 78494ms
Leaves: 3195901860
LPS : 40715237
I'm now doing 36.7 million leaves/s in 87.1 seconds (which is about 1.5 seconds faster than the _previous_ version of Weiss I tested) on this system; and at the time, _that_ version was also ahead of Rustic by 8-9 seconds or thereabouts.
Since I began in this thread, I gained about 30% speed in move generation/make/unmake, so it has been worth it.
I don't know where I can gain another 8+ seconds. Everything I do now makes the code slower.
- Replace clear/set-bit with square bitboards and the |= and ^= trick: -10%
- REMOVE 4 asserts that erronously got left in as an array bound check: -12%
- NOT doing gamestate updates (move counter and such) if the move is illegal (because they'll be reverted anyway), i.e. returning the function early on an illegal move: -12%
- Fold the rook capture code into the castle perms array code: slower by 10-15% (varies)
- Even compiling code into the engine that isn't used during perft (the console) makes it slower by at least 10%.
I can't control this.
It probably has to do with memory alignment and related things as discussed earlier in this topic. It's not logical that when I return early from make() when the move is illegal, which omits doing certain steps, is SLOWER than actually doing the superfluous steps and THEN returning. It's not only slower in the start position (where there aren't many illegal moves), but in all positions I've tested.
Maybe if I just finish the search and UCI functionality, and then try again... as said, it seems that speedup tricks become usable when the code gets bigger. In the beginning, the to ^ 8 trick didn't work (slower), and the CastlePerms update didn't either (slower); now the to ^ 8 trick for EP does work (a second or two gain), and the CastlePerms array is now equal to what I had before, but with less code.