3 ms·
Ask HN: How would you implement an (accurate) progress bar?
Progress bars in existing software are often "broken". That is, by observing a progress bar, the user often cannot predict how long an operation will still take. Sometimes, the bar runs to 100% in a matter of seconds, after which processing continues for minutes or hours. In other cases, they hang at a low percentage, and then they suddenly skip to 100%. Similarly, "ETA" indicators are often broken too.
So, how would you implement a progress bar that Just Works (TM)?
Or is the problem so difficult to solve correctly, that it would require a Ph.D. project? In that case, the question is: why has nobody done theoretical work on the subject?
- viraptor 9y agoA progress bar for what? Some things are trivial (copying a local file with a known size), some are impossible (streaming a file of an unknown size). It's not the problem is a progress bar, it's a problem of: - How reliably can you provide the current stage mapped to the linear progress (do you know what step you're on? Do you know how many store exist / are enabled / are applicable?) - How reliably can you map each stage to the time required? Does it depend on the environment / hardware / selected configuration? For many cases the second one is basically unknown. You can still do a combination of lists and progress bars per step, or something similar to make it easier.
- amelius 9y agoValid questions! Of course, we should assume that the information which the progress bar needs is "knowable". And perhaps the question needs better phrasing, because there will be a trade-off between the resources used for computing the progress and it's accuracy.
- gus_massa 9y agoSomewhat related "Using Zeno's Paradox For Progress Bars" [the article is dead, but this is the archived version] https://web.archive.org/web/20140224013525/http://www.atalasoft.com/cs/blogs/loufranco/archive/2006/12/01/11155.aspx https://web.archive.org/web/20140224013525/http://www.atalas... More in: http://cerealnumber.livejournal.com/27537.html#/27537.html http://cerealnumber.livejournal.com/27537.html#/27537.html
- PaulHoule 9y agoMy favorite progress bar implementation is in Hadoop because Hadoop breaks problems into small chunks that are (almost always) predictable so it can give a good ETA even at a few percent level. Something I've thought about (but not done) is making something that records the log entries that a build process emits as it runs and then compares the progress of the current run to the historical database.