Question

I'm trying to optimize my chess program. I'm using ulong bitboards to generate legal moves as I thought it would be very quick. Profiler, however, suggests that much of the time is spent on bitwise AND operation (over 20% of inclusive samples, as shown below; analysis performed several times with the same result).

The profiled code was optimized x64, ran on VMWare Player (Windows 7 guest, Debian host). I couldn't get Mono Profiler to work to see if it produces the same results, but Mono executed natively on Linux ran code exactly the same time as .Net framework on VMWare.

Can the report shown below possibly be correct and the operation is indeed that heavy, am I misinterpreting it, or is the profiler inaccurate?

Result of profiling

Was it helpful?

Solution

It turns out to be a profiler inaccuracy. I moved the line above the AND operation (ulong movesBitboard = ...) to some other location and now this line is marked as taking over 20% of samples - and that result is perfectly reasonable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top