Benchmarking
In theory, you can compare the actual-time speeds of two algorithms by running the code on your computer and using a stopwatch to see how long each algorithm takes. This is the essence of what benchmarking is, except that benchmarking is a lot more practical. Besides being tedious, using a stopwatch to measure the speed of code is error-prone. Also, what if the two algorithms both run in less than one second? You’d better have fast thumbs.
Thankfully, you can use benchmarking software to measure the time for you. The software tracks the precise time your code starts running and when it finishes. The benchmarking tool then tells you exactly how much time your code took to run.
So, there’s nothing fancy about benchmarking; it’s basically ...
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