How to calculate percentage improvement in response time for performance testing

后端 未结 7 2043
梦如初夏
梦如初夏 2021-01-29 19:55

How should I calculate the percentage improvement in response time.

I am getting 15306 ms response time for old code and 799 ms response for th

7条回答
  •  [愿得一人]
    2021-01-29 20:34

    I think the answers above suffer from the original question not having nice round numbers and that there are 3 different ways to state the result.

    Let's assume that the old time was 10 seconds and the new time is 5 seconds.

    There's clearly a 50% reduction (or decrease) in the new time:

    (old-new)/old x 100% = (10-5)/10 x 100% = 50%
    

    But when you talk about an increase in performance, where a bigger increase is clearly better, you can't use the formula above. Instead, the increase in performance is 100%:

    (old-new)/new x 100% = (10-5)/5 x 100% = 100%
    

    The 5 second time is 2x faster than the 10 second time. Said a different way, you can do the task twice (2x) now for every time you used to be able to do it.

    old/new = 10/5 = 2.0
    

    So now let's consider the original question

    The old time was 15306 ms and the new time is 799 ms.

    There is a 94.7% reduction in time.

    (old-new)/old x 100% = (15306-799)/15306 x 100% = 94.7%
    

    There is a 1816% increase in performance:

    (old-new)/new x 100% = (15306-799)/799 x 100% = 1815.6%
    

    Your new time is 19x faster:

    old/new = 15306/799 = 19.16
    

提交回复
热议问题