✅ Calculating Remaining Processing Time?
Let's say I'm running a bunch of loops and searching long arrays - essentially some task that will take, let's say, 10 seconds on average. How can I calculate the amount of time remaining to complete the calculation to show to the user of the app?
6 Replies
time how long a fraction of the problem takes and extrapolate that to the whole job
Is there no other way of doing it?
I can do that but I'd prefer being able to predict it with reasonable accuracy
what i suggested will give you reasonable accuracy assuming the job does a consistent amount of work over its execution
you can update the estimated time periodically to make it more accurate the longer the job runs
Ok I'll try implementing that, thank you.
I just hate it when an app says it'll take a minute and it takes 5, don't want to have the same thing here.
But this is a super duper predictable ETA so not a bother
unless you have a time machine your guess can only get so close
I'll just go code one real quick
Watch me