Java performance bottlenecks
I’m working on a game written as a Java application for a research project at my University. I’m in a group of eight people, but only three of us are actual coders. We’ve been writing the game for over a year now, and we’re now measuring the time to the end in weeks, not months or years.
The problem is, we’ve been developing our game on high-performance PCs. But the game is going to be deployed on oldish Apple desktops and laptops. We tried running it once, but it simply didn’t happen. The game is either too CPU-expensive or memory-expensive. Either way, it’s something we need to fix.
I’ve been using the Extensible Java Profiler (ejp) to find the bottlenecks in our code. So far it’s actually been really helpful, and I’ve made several changes to reduce the number of calls to certain expensive functions by as much as ten times. It’s also looking like we’re going to have to end up ripping out all of the audio files. We put a lot of work into them, but they’re kind of memory-expensive and not strictly necessary. Besides, in our deployment environment, with about twenty kids all playing the game simultaneously, sound simply isn’t going to work — all of the computers will just drown each other out.
This whole experience is eye-opening as I’ve never really had to deal with program optimization before. We haven’t explicitly covered it in any of our computer science classes. Learning “in the breach” as it were is a bit frenetic, but definitely provides motivation. It’s kind of sad having to cut out parts of our game to get them working on less-capable computers.