In his article "Back to Basics", Joel Spolsky illustrates a common (and unnecessary) pattern that increases the complexity of programs. Essentially, when one does in C:
char string; strcpy (string, "One "); strcat (string, "Two "); strcat (string, "Three "); strcat (string, "Four "); . . .
And so forth, then the strcat calls will keep starting from the beginning of the string and seek the (increasing) end, times and again. As a result, the complexity of appending N strings each with a limited length, becomes O(N^2) instead of O(N).
Eliminating such problematic mis-implementations in the code can yield a substantial speed-increase.
External Links Edit
Part of this article was taken from the "Optimizing Code for Speed" Wikibook.