Performance Tuning with Jfluid
One of my primary tasks right now is improving the speed of the Sphinx-4
recognizer. There are three battle-lines in this war on slowness:
improving algorithms, improving application tuning, and optimizing the
code. One of my primary tools in the war is Jfluid
, a Java application profiler developed by the folks at Sun's research
lab. JFluid works differently from other profilers ... instead of sampling
your application periodically to find out where time is being spent, it
instruments the byte codes. This has a number of advantages. First of all,
the profiling results are exact, not approximate. Due to the vagaries of
sampling, other profilers are apt to miss calls to some methods entirely.
Since JFluid instruments the byte codes, it never misses a thing. If
Jfluid says that a method has been called 1,232,123 times, you know that
it really was. JFluid also lets you select a narrow subset of your
application to profile. For instance, the typical recognition inner loop
looks like this:
while (!done) {
scorePaths();
prunePaths();
growPaths();
}
with a substantial fraction of the work taking place in growPaths(). With
JFluid, you can turn on profiling for growPaths() and every method that is
called (directly or indirectly) from growPaths() while leaving profiling
off for scorePaths() and prunePaths(). Other profilers I've used require
you to turn profiling on for the whole application which results in my
having to wait much longer for answers as the profiler wastes time
collecting data on scorePaths() and prunePaths().
JFluid is one of the best kept Java secrets. If you are working to improve your application's performance I highly recommend giving JFluid a try.