One of my last tasks in preparing for the recent release of Sphinx-4 was to improve the performance of the DynamicFlatLinguist . The DynamicFlatLinguist is used to generate the search graph used by the decoder during speech recognition. The DynamicFlatLinguist generates the search on-the-fly as the recognizer search algorithm explores the graph. This allows very large and perplex grammars to be used without incurring long grammar compile times or enormous memory footprints. Although the DynamicFlatLinguist worked well in terms of reducing startup time and overall memory footprint, it resulted in recognition speeds of about 3X slower than that of the non-dynamic flat linguist. So my final task in preparing for the release was to reduce the speed penalty of the DynamicFlatLinguist.

I had some idea where the bottlenecks in the linguist might be, but I wasn't exactly sure and often times my intuition on such things is just plain wrong, so I fired up JFluid to profile Sphinx-4 while using the DynamicFlatLinguist. One really powerful aspect of JFluid is that it can profile a small subset of the code, and this subset can easily be changed on the fly. So with JFluid, I could get an overall profile to see where the recognizer was spending its time, and then focus in directly on the hotspots related to the DynamicFlatLinguist. JFluid showed me that my intuition was partially correct about where the bottlenecks were, but it also showed a few problem areas that I hadn't anticipated. Based upon the JFluid results, I was able to focus my optimization efforts on the proper methods. A cache here, a code hoist there and soon the DynamicFlatLinguist was running 3 times faster.

JFluid continues to be one my favorite tools, but soon JFluid will be no more. Not because it is going away, but because it is now being incorporated into NetBeans. As of NetBeans 3.6 an early access version of JFluid technology can be incorporated directly into the IDE. JFluid will become the NetBeans Profiler.

Comments:

Post a Comment:
Comments are closed for this entry.

This blog copyright 2010 by plamere