Collecting performance metrics, I needed a way to compare before/after numbers from optimizations into some meaningful value that would impress the brass.
I don’t recall where I found these except that my Google-fu shone a light to help me get to the formulae below. I’ve had them in my notes at work for ages and today I thought to add them here for reference.
Formula: (newValue - oldValue) / oldValue * 100 = percent
E.g.: the amount of time it took to run an operation is 2348 milliseconds (
oldValue). After an optimization, the operation executes in 842 milliseconds (
(842 - 2348) / 2348 * 100 = -64.139693356% reduction in execution time
Formula: (oldValue / newValue) - 1 = x times improvement
Think of this result as the number of times the improved performance (
newValue=842) will run above and beyond the amount of time it took the old implementation (
oldValue=2348). Using the values from the previous example:
(2348 / 842) - 1 = 1.7885985748x performance gain
Pretty good, almost a 2x gain. That means the new operation can almost run three times in the same amount of time it took the old operation. Good job! Now write a report and ask for a raise.