Tuesday, February 07, 2006

The Benchmark

I think that today was the day that Garth Brooks "The Lost Sessions" was being re-released as a stand-alone albumn at Walmart (it was originally part of the box set) with 6 additional tracks. Yes, marketing at work, but I've heard at least 2 of those new songs and I have to get it. Amazing! I'll definitely be checking that out later in the week.

Tonight won't be so long a blog. I really didn't spend any time working on my project. That will probably wait until Thurs/Fri now. I would like to get the move generator at least partly functional by the end of the weekend, but there's a lot of work to do before I get there. I'm thinking about creating a flowchart just to help me visualize what I'm planning and maybe keep me a little more focused on the appropriate areas.

I was fortunate enough at work today to do some JDBC driver benchmarking with SQL Server 2005 Express. Mainly because I have a database with tons of records and Microsoft has a JDBC driver available. I've always used the open source jTDS driver, but I wanted to see what the microsoft one could do. Imagine my surprise when it didn't do so well! The benchmark consisted of "INSERT"ing 30,000 records into a table. When I ran the program using the Microsoft JDBC driver it took 1:53 (1 minute 53 seconds). Then I swapped in the jTDS driver and ran it again. 32 seconds! Wow! I can only imagine all of those java programmers out there who decide to use the Microsoft jdbc driver with their programs because "Microsoft released it for their database so it's got to be good".

Back to my project for a minute. Another thought that has been running through my mind lately is the generating of legal pawn moves and pawn captures. There will definitely be a lot of opportunity for performance testing with this project, let's just hope I keep focused and am able to do even a fraction of what I'd like to. My past experience and research had me leaning towards an array of pawn bitboards. Since there are 64 squares in the chessboard, therefore 64 possible squares that a pawn could be on (not exactly true, it's actually 56 since a pawn can never actually be on it's own 1st rank) we would have the bitboards legal_pawn_moves[0] through [legal_pawn_moves[7] be 0 (all 64 bits 0) since there are no legal moves from the 1st rank since a pawn can't be on the first rank. In case we wanted to leave room for handling odd compositions and whatnot, we could always choose to list the "legal" moves if we wanted to. I'd like to do some diagrams to explain better, but I think I need to wait until I've done a little more research. Right now I have some uncertainty in the exact implementation of these ideas and I need to work through them. But what I wanted to get to was a new idea. I'm not sure if it would be faster or slower, but it's interesting. I read it somewhere on the Internet the other day and it seemed interesting. It's the idea that to generate all of your legal pawn moves, since a pawn can only move 1 square ahead (or 2 on its first move) all you'd need to do is take the current pawn bitboard, shift it to the right 8 positions, and you have all the current pawn moves (minus the captures).

Well, I wanted to get to bed by 10 tonight, and it's 9:55, so I'm not going to make it. I want to spend a few minutes on my guitar first, so I best be going.

Rock on!

Ed.

No comments: