Chapter 5. Measuring Time and Complexity

IN THIS CHAPTER

In previous chapters, you have seen how to identify parts of programs that are likely candidates for optimization. You have also seen that it is necessary to determine whether it is worth optimizing an existing algorithm, or whether a completely new algorithm is necessary to achieve the necessary performance goals. However, when you have a choice between a large number of algorithms, how do you decide which will be fastest? Do you implement all of them and do speeds tests or can something intelligent be said beforehand? Also, how exactly can you perform speed comparisons easily between different algorithms?

This chapter introduces you to the tools and background information you will need when optimizing your software. The concepts laid out here are used throughout this book to prove and demonstrate the presented theory. The subjects covered in this chapter are: a notation of algorithm complexity, a handy timing function to use in your code, system influences to look out for when performing timing tests and tips to decrease the influence of the system.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset