Re: how to implement ETA
Re: how to implement ETA
- Subject: Re: how to implement ETA
- From: Jens Alfke <email@hidden>
- Date: Sun, 1 Jun 2008 09:09:07 -0700
On 1 Jun '08, at 5:50 AM, Nick Rogers wrote:
I want to show time remaining while executing a loop.
How to go about it?
Basic algebra, mostly. Compute the elapsed time (current time minus
time the loop started), divide by the number of iterations so far
[that gives you the time per iteration] and multiply by the number of
iterations remaining.
Two caveats:
(1) It's best not to show this until you've gone through several
iterations, because early on the results can be very inaccurate and
vary wildly from one iteration to the next. I usually wait till the
loop's about 10% done.
(2) This works best if the iterations take a consistent amount of
time. If they vary, then the farther the progress gets, the more the
estimate is based on past timing and not on the current speed. For
example, if you're downloading, and the network slows down halfway
through, the estimate won't be accurate because it's based mostly on
the earlier faster speed. Fixing this isn't rocket science (or tensor
calculus) and is left as an exercise for the reader ;)
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden