Updated: 2003-03-11; 9:11:19 AM
Doug's Inner Net News
    News and views from a software developer's perspective

daily link  Wednesday, February 05, 2003

I spent Monday optimizing some C++ code that parses MIME messages. My first benchmark surprised me -- the parser was unbelievably slow. On the Sun workstation, I used the profiling tools to analyze the performance. Then I began making various tweaks wherever I found a hot spot. In the end, I achieved a speed-up of 70 times. There are two lessons to be learned from this exercise. First, it is possible to write very inefficient code in C++. Second, profiling tools are extremely valuable in helping one to increase the performance.

On Tuesday I ran a comparison test of the C++ code with similar Java code. The Java code ran roughly twice as fast as the C++ code. I imagine that I could continue to tweak the C++ code to get better performance. However, I expect continuing to tweak the C++ code would mean losing some of its functionality, or else making the code uglier. 

5:22:15 PM  permalink 


Copyright 2003 © Doug Sauder