Re:CTTK: Constant-Time Toolkit
by Spivak on Sunday February 25, 2018 @01:49PM
(#16460442)
Suppose that x is the true time the operation takes. Then suppose that R is a random variable distributed uniformly on [0, 1000]. If I take a sample I will get values following the distribution x + R.
Then we calculate the sample mean of this distribution, X. Keep in mind that I can then set the number of samples to take to achieve my desired accuracy and confidence.
Then we look at the mean of the distribution x + R?
E(x + R) = E(x) + E(R) = x + E(R) = x + 500
So therefore the true running time is recoverable by taking X - 500.
Then we calculate the sample mean of this distribution, X. Keep in mind that I can then set the number of samples to take to achieve my desired accuracy and confidence.
Then we look at the mean of the distribution x + R?
So therefore the true running time is recoverable by taking X - 500.