Friday, November 30, 2012

Are We There Yet?

I keep making significant improvements, yet I still feel no closer to being "done." I guess that's the nature of a complex project like this. It will probably never be "done." But I won't let perfect become the enemy of good. I'm going to release whatever I've got to the $10 backers tomorrow.

One small improvement I made today was to color only the dashed part of one-ways red, so their direction is more evident when the map is zoomed way out:

I can't get over how sweet the map looks, and I've barely started working on it. Once you understand it, Prefuse is (mostly) a joy to work with, and the rendering is fast and looks so damn good. Static screenshots don't do justice to the zooming, panning, and node-dragging controls that can be added to a Display with just one line of code.

One of the few weaknesses of Prefuse is that it stubbornly holds onto references to everything you put in its Tables, and therefore tends to leak memory. There are dozens of threads about memory leaks on the Prefuse forums. I spent several hours this evening tracking down object references in VisualVM, but I think I've finally got it licked. I had to null all the parts of the map except the Display and the filter and layout actions, call setVisualization(null) on those three things, and then call reset() on the Display before a closed database would be released to the garbage collector.

I'm pretty happy with what I'm seeing in the profiler. With a 1K universe loaded, the app uses about 30 MB of heap, smoothly climbing to around 45 MB before the GC runs. With a 30K universe, heap usage peaks around 90 MB.

I've been so intensely focused for so long on all the little ways in which this project hasn't met my expectations that it's a bit of a shock to step back and look at what I've accomplished. I wrote a freakin' TradeWars helper! If it doesn't work exactly the way I want, I can change it myself. This is something I've dreamed of since I was fifteen years old. All told, it's taken me over fourteen months to get to this point, but most of the work was done in the last three. It probably goes without saying that the best way to find all the little things that need fixed in a program is to actually use it, and I'm looking forward to doing exactly that.

No comments:

Post a Comment