This preview shows page 1. Sign up to view the full content.
Unformatted text preview: re one half of the time is spent performing lower-case conversion. We have already seen that function lower1 has very poor performance, especially for long strings. The words in this document are short enough to avoid the disasterous consequences of quadratic pe- 266 CHAPTER 5. OPTIMIZING PROGRAM PERFORMANCE formance; the longest word (“honoriﬁcabilitudinitatibus”) is 27 characters long. Still, switching to lower2, shown as “Linear Lower” yields a signiﬁcant performance, with the overall time dropping to 0.52 seconds. With this exercise, we have shown that code proﬁling can help drop the time required for a simple application from 9.11 seconds down to 0.52—a factor of 17.5 improvement. The proﬁler helps us focus our attentionon the most time-consuming parts of the program and also provides useful information about the procedure call structure. We can see that proﬁling is a useful tool to have in the toolbox, but it should not be the only one. The timing measurements are imperfect, especially for shorter (under one second) run times. The results apply only to the particular data tested. For example, if we had...
View Full Document
This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.
- Spring '10
- The American