Tuesday, March 10, 2009

Java perft, again

After some more optimizations my Java perft now runs much faster than before, it is now nearly half as fast as the C code. I would have expected much less from Java and am pleasantly surprised. I'm quite happy already with the Java engine, so now for the hard part - creating an interface....

perft 1 time 1 positions 7 kN/s 7
perft 2 time 1 positions 49 kN/s 49
perft 3 time 1 positions 302 kN/s 302
perft 4 time 1 positions 1469 kN/s 1469
perft 5 time 1 positions 7361 kN/s 7361
perft 6 time 15 positions 36768 kN/s 2451
perft 7 time 1 positions 179740 kN/s 179740
perft 8 time 63 positions 845931 kN/s 13427
perft 9 time 250 positions 3963680 kN/s 15854
perft 10 time 1156 positions 18391564 kN/s 15909
perft 11 time 5437 positions 85242128 kN/s 15678
perft 12 time 24954 positions 388623673 kN/s 15573

2 comments:

  1. I've let my own primitive checkers program (named "milhouse") lie dormant for over a year, but your awakening has reminded me to dust it off again. Your perft numbers are apparently quite helpful, and have told me that I very likely have a bug, since these are the numbers I get:

    depth 1 positions 7
    depth 2 positions 56
    depth 3 positions 358
    depth 4 positions 1827
    depth 5 positions 9188
    depth 6 positions 45956
    depth 7 positions 225696
    depth 8 positions 1071627
    depth 9 positions 5035307
    depth 10 positions 23426871
    depth 11 positions 108668999
    depth 12 positions 497292672

    Not sure what's going on here, but it should be obvious when I print out all the level two positions...

    ReplyDelete
  2. Doh. Stupid mistake. I counted all nodes, not just leaf nodes. I instrumented my code (C) and ran it, yielding:

    running perft performance/accuracy test.
    depth 1 positions 7 (0.000 seconds, 699 KN/s)
    depth 2 positions 49 (0.000 seconds, 3805 KN/s)
    depth 3 positions 302 (0.000 seconds, 7771 KN/s)
    depth 4 positions 1469 (0.000 seconds, 10568 KN/s)
    depth 5 positions 7361 (0.001 seconds, 12050 KN/s)
    depth 6 positions 36768 (0.003 seconds, 11566 KN/s)
    depth 7 positions 179740 (0.015 seconds, 11647 KN/s)
    depth 8 positions 845931 (0.077 seconds, 11045 KN/s)
    depth 9 positions 3963680 (0.354 seconds, 11204 KN/s)
    depth 10 positions 18391564 (1.375 seconds, 13373 KN/s)
    depth 11 positions 85242128 (3.601 seconds, 23672 KN/s)
    depth 12 positions 388623673 (16.578 seconds, 23441 KN/s)

    ReplyDelete