Page 1 of 1
Profiling Java AI
Posted: 22 Nov 2015, 16:44
by aeonios
I've recently been working on Zero-K Graph Based AI (ZKGBAI:
https://github.com/Anarchid/zkgbai) and ran across some problems with pathological (ie 1fps) lag issues. I want to profile it to see if I can track down what's eating CPU so badly, but since it's not a standalone app most approaches to profiling won't work. The most promising profiler I came across was jrat (
http://jrat.sourceforge.net/), but that requires calling the ai through jrat through the jvm, which means I have no idea with spring.

Does anyone know the easiest way to set up such a thing?
Re: Profiling Java AI
Posted: 23 Nov 2015, 14:48
by AF
Your lag, can you determine its nature? Is it continuous lag, super spiky lag, regular short period spikes? The standard ingame profile should help find this, and might give clues as to what to look for if it's regular spikes.
What IDE are you using to build and run the AI?
Re: Profiling Java AI
Posted: 28 Nov 2015, 18:13
by aeonios
It turns out it was probably because the threatmap was being redrawn every time enemyEnterLos was called. ._.
Re: Profiling Java AI
Posted: 04 Jan 2016, 23:50
by PauloMorfeo
How did you find that out? Did you do Ad Hoc profiling (ex: dump into a file the time spent inside functions X, Y and Z)? Or what did you use to profile?
Re: Profiling Java AI
Posted: 09 Apr 2017, 01:36
by DeinFreund
You can simply use the NetBeans Profiler. It shows you the time spent in each method, memory usage per object and some other helpful stats. It helped me a lot in optimizing CSI.