Chapter 2Benchmarking Code
Throughout Volume 1, we’d worked with the idea that an algorithm’s speed is measured by counting its steps. However, you saw in the previous chapter that sometimes simply counting steps isn’t enough to determine which algorithms are faster than others. For example, both Quicksort and Mergesort take roughly the same number of steps, yet computer scientists report that Quicksort is significantly faster in actual time. Again, by actual time I mean time measured in minutes and seconds rather than in steps.
How do the computer scientists know this? More importantly, how can you know which algorithms are truly the fastest?
Here enters a technique known as benchmarking. In this chapter, you’ll learn what benchmarking is and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access