Steve Maughan wrote:I had thought that the perceived wisdom was that the move generation routine in a typical program only takes up only about 10% of a program's execution time and is therefore not worth spending too much time optimizing . However Fruit 2 introduced incremental move generation and I think Fabian said this was added as the nodes / sec were getting too low. This implies that you can get a (significant) speed impovement by adding IMG, which flies in the face of the conventional wisdom about move generator only taking up 10% of the a programs time.
Hi Steve,
I think "time" profiling functions separately is misleading in chess engines. Please for the "move generation" module include all move-ordering heuristics as well (because with incremental generation, fewer moves will be scored+sorted as well as generated). I am sure it is more than 10% in some engines. It is usually difficult to measure though, but advanced development tools might provide this.
As I recall 10% is what I GAINED by going incremental, but my previous code was really naive: generate all moves, then score all moves then sort all moves (sorting incrementally did not buy anything significant). This might be less for engines that generate+score at the same time.
Of course incremental generation is a lot more complex, no doubt. But I found it interesting to write (e.g. I see it as a virtual machine that has instructions). After making the change I could easily try different move orderings.
Let's sum up. I suggest you measure time spent in this module in a SERIOUS way, really find ALL functions that are related to this part of the engine. I think you will find the number is higher than what you might expect by say only looking at move_gen() or whatever.
I warn you (all) especially against measuring time in a naive way as they like to describe in so many software books. There will be no function eating 90% of the time in a decent chess engine (even if your eval does, it should be split further). Our programs are simply a lot more complex than beginner examples.
Fabien.