What's a good algorithm for determining the remaining time for something to complete? I know how many total lines there are, and how many have completed already, how should I estimate the time remaining?
See Question&Answers more detail:osWhat's a good algorithm for determining the remaining time for something to complete? I know how many total lines there are, and how many have completed already, how should I estimate the time remaining?
See Question&Answers more detail:osWhy not?
(linesProcessed / TimeTaken)
(timetaken / linesProcessed) * LinesLeft = TimeLeft
TimeLeft
will then be expressed in whatever unit of time timeTaken
is.
Thanks for the comment you're right this should be:
(TimeTaken / linesProcessed) * linesLeft = timeLeft
so we have
(10 / 100) * 200
= 20 Seconds now 10 seconds go past
(20 / 100) * 200
= 40 Seconds left now 10 more seconds and we process 100 more lines
(30 / 200) * 100
= 15 Seconds and now we all see why the copy file dialog jumps from 3 hours to 30 minutes :-)