Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JProfiler, Perft and performance observations #89

Open
osvitashev opened this issue Dec 28, 2021 · 0 comments
Open

JProfiler, Perft and performance observations #89

osvitashev opened this issue Dec 28, 2021 · 0 comments

Comments

@osvitashev
Copy link

I decided to run Perft function with JProfiler.
Overall, Perft runs at about 3 million nodes/second on my machine, which is pretty slow, but i realize that Java is supposed to be slower than C++. For comparison, kz04px/libchess which is written in C++ runs at about 50 million nodes/second.
Here are some observations:

  • LinkedList.add and LinkedList.addLast together contribute to 30% of both CPU and memory allocation time. Perhaps LinkedList is not the best choice for storing legal moves and move history, due to the memory being allocated incrementally?
  • Long.valueOf takes about 10% of CPU and memory allocation time. Seems like there might be some extra conversion between java primitive and object wrapper.
  • MoveBackup and EnumMap take up about 10% or resources each. Perhaps, EnumMap has too much of a footprint for a structure which essentially only stores four boolean flags.
  • Board.doMove takes about 15% of resources. Here, i am not sure what can be improved, at the moment.

I might take a stab at these at some point. Below are JProfiler screenshots. Let me know is i am on a totally wrong track.

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant