You never can tell

In my first experiences of making an ABM, I’ve been surprised by how slowly a seemingly simple Java program can run. This led me to look at how to profile a running Java application to see where it’s spending most of its time.

Oracle’s frankly-amazing Java VisualVM allows you to do just that and the results, in my case, were highly unexpected.

Despite running an ABM with, as I thought, fairly high levels of structural complexity (i.e. agents all have their own worldview, including little imaginary copies of all the other agents they know about, which get updated as and when an indenpendent and omniscient ‘GamesMaster’ allows), the program turned out to be spending the vast, vast majority of its time working out which spaces are neighbours to which others. This is clearly absurd and now I’m off to tweak the algorithm. A faster model should result…

First ever profiler output
Profiler output showing huge overheads in checking neighbouring spaces
Advertisements

Author: Rob Levy

Economist at NEF. Former teaching Fellow in Economics at UCL and Bristol University. Recently submitted my PhD. We'll see what happens...

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s