Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrect seconds_per_step calculation
seconds_per_step looks at a ring buffer with samples taken each tick. Each sample is <duration of the tick> / <number of progress steps> This results in an incorrect seconds_per_step, when this is calculated as a raw average of the buffer values. This is because we have no reason to assume any tick is a more representative sample than any other tick, but this will treat ticks with very few steps as *more* representative than steps with many ticks, because the value of the denominator is lost. The result is a very poor ETA / bitrate estimation when step production follows a burst-wait pattern, since ticks with few or no steps are to be expected. A better estimate could be achieved by averaging over the step-rate of each tick, but this would still not be idea since it would treat short ticks as equally representative as long ticks in the average. Instead, we add a second ring buffer for the duration of each tick, and use this to calculate a *true* weighted average when determining seconds_per_step.
- Loading branch information