C
C#13mo ago
AdiZ

✅ 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
Jimmacle
Jimmacle13mo ago
time how long a fraction of the problem takes and extrapolate that to the whole job
AdiZ
AdiZOP13mo ago
Is there no other way of doing it? I can do that but I'd prefer being able to predict it with reasonable accuracy
Jimmacle
Jimmacle13mo ago
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
AdiZ
AdiZOP13mo ago
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
Jimmacle
Jimmacle13mo ago
unless you have a time machine your guess can only get so close
AdiZ
AdiZOP13mo ago
I'll just go code one real quick Watch me
Want results from more Discord servers?
Add your server