java and history heuristic

Discussion of chess software programming and technical issues.

Moderator: Ras

CheckersGuy
Posts: 273
Joined: Wed Aug 24, 2016 9:49 pm

java and history heuristic

Post by CheckersGuy »

Hey,
I have a Java specific question. I have a static array for my history-heurstic (counterMovers and Killers as well). Now I read that static variable acess is slower compared to local varaible acess. I clear my heuristics everytime so would it be better to pass the history heuristics (counterMoves etc.) as a parameter to my search ?

Would like to know what you think



Robin
sandermvdb
Posts: 160
Joined: Sat Jan 28, 2017 1:29 pm
Location: The Netherlands

Re: java and history heuristic

Post by sandermvdb »

CheckersGuy wrote:Hey,
I have a Java specific question. I have a static array for my history-heurstic (counterMovers and Killers as well). Now I read that static variable acess is slower compared to local varaible acess. I clear my heuristics everytime so would it be better to pass the history heuristics (counterMoves etc.) as a parameter to my search ?

Would like to know what you think
I don't completely understand what you are saying but it is correct that static variables are slower than local variables. This will probably only be a couple of percent of the total calculation time when performing a search so readability and maintainability are way more important! Try not to spend much time on micro-optimizations which this is :)

Regarding clearing the array, use the method Arrays.fill()

Using tools like VisualVM you can analyze the performance of your engine

Goodluck!