This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ng to lower case. 264 CHAPTER 5. OPTIMIZING PROGRAM PERFORMANCE 10 9 8 7 6 5 4 3 2 1 0 Initial Quicksort Iter First Iter Last Big Table Better Hash Linear Lower CPU Secs. . Rest Hash Lower List Sort (a) All versions.
2 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 0 Quicksort Iter First Iter Last Big Table Better Hash Linear Lower Rest Hash Lower List Sort . CPU Seconds (b) All but the slowest version. Figure 5.37: Proﬁle Results for Different Version of Word Frequency Counting Program. divided according to the different major operations in the program. Time is 5.15. IDENTIFYING AND ELIMINATING PERFORMANCE BOTTLENECKS
Hash Computing the hash function. Rest The sum of all other functions. 265 As part (a) of the ﬁgure shows, our initial version requires over 9 seconds, with most of the time spent sorting. This is not surprising, since insertion sort has quadratic complexity, and the program sorted nearly 27,000 values. In our next version, we performed sorting using the library function qsort, which is based on the quicksort algorithm. This version is labeled “Quicksort” in the ﬁgure. The more efﬁcient sorting algorithm reduces the ti...
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