Right-BICE[P]: Performance Characteristics
Learn how to evaluate a program based on performance through unit testing.
Performance is one of the most important factors of unit testing.
Rob Pike of Google: “Bottlenecks occur in surprising places, so don’t try to second guess and put in a speed hack until you have proven that’s where the bottleneck is.”
Indeed, many programmers speculate about where performance problems might lie and what the best resolution might be. The only problem is that their speculations are often wrong.
Unit tests for performance evaluation
Rather than guess and stab at performance concerns, we can design unit tests to help us understand where the true problems lie and whether or not our speculative changes make enough of a difference.
The test given below asserts that a bit of code runs within a certain amount of time. Check the highlighted lines (71-88) and run the code below: ...