Exercise: Benchmarking Functions
Test your coding skills on benchmarking functions.
We'll cover the following
Challenge
In this exercise, your challenge is to expand the colStats tool that was developed previously while benchmarking it to ensure it performs well.
Problem Statement
Improve the colStats tool by adding new statistical functions, benchmark them, and make changes to improve their performance.
Coding Challenge
Improve the colStats tool you developed in this Chapter, by adding two more statistical functions min
and max
, which return the lowest and the largest values in a given column.
Write tests for these functions. Think of the best way to do this. Remember that you’re using table-driven tests for the other operation functions.
Write benchmarks for the new functions min
and max
.
Start from the colStats implementation at the end of this Chapter. Implement a first version of these functions, test, and benchmark them. Try to rewrite the function with a different logic, test and benchmark it again, and see if it performs better or worse than the previous version.
Run the following commands for min/max
function.
Get hands-on with 1400+ tech skills courses.