Helping people with computers... one answer at a time.
Awful progress bars can drive us crazy, but there's a good reason for it. Progress bar software is difficult to write.
Why are progress bars so awful? I'm not just talking about the Windows file-copying and move bars which are pretty well known for this but I don't think I've found a progress bar for anything that's not inclined to get stuck at a certain percentage for a long time or jump around or sporadically speed up and slow down. Why haven't they figured out a way to be more accurate as of yet?
In this excerpt from Answercast #91, I look at the difficulties software designers have in writing progress bars for copying and installing files.
Well, the short answer is that it's a really, really, really hard problem.
You'd think that it would be fairly simple and straightforward but as it turns out, it's an incredibly complex thing to try and figure out how much time is really remaining. There are many things that come in to play.
Most progress bars that we see have to do with file copying of some sort. Not just the progress bars that you've referred to, in things like Windows Explorer, but even when you're running a setup program. What a setup program is spending most of its time doing is copying files.
So, what does the setup program need to figure out just exactly how far along you've gotten?
Is it the number of files?
Well, it can't really be the number of files - because some files are big and some files are small. We can't really assume that if you've copied half of the number of files you're actually halfway done. If the first half of the files were all small and the second half were much larger, obviously, the second half, based on the number of files, is going to take a lot longer than the first half.
Maybe it has to do with file size?
Well, that kind-of sort-of works. It assumes you can pre-calculate exactly how much file size you're copying.
In the case of a setup program, that gets really weird because it means the setup program can't calculate what's going to be installed... as it goes. To provide an accurate progress bar it would first have to figure out everything that's going to be installed, without installing it, and then finally kick in the install process and start copying the bits and bytes that are resulting from the choices you made when you setup that program.
The problem is; that really isn't even good enough. Why? Well, the hardware starts to play a role.
Hardware has different speeds. Everything from:
Things taking longer to read on the outside of a CD than from the inside,
to things like information that's being buffered by various pieces of hardware.
The first one-megabyte of data may go in very quickly. The second megabyte may come out very slow.
But wait, there's still more. It also depends on what else your computer is doing.
If your computer is accessing the disk while all of this copying is going on? That too is going to cause any calculation that would end the progress bar to, by definition, be wrong - because all of a sudden the copying that the progress bar is assuming is happening by itself, is now being interfered with by whatever else is happening on the machine.
So, yes, there are absolutely some progress bars that are abysmal. They are so inaccurate as to be completely useless. You have no idea how many times I've spent looking at a "90% done" progress bar that seems to take about 90% of the time to make that last 10% copy.
On the other hand, I have a lot of sympathy for the people who write the software that does that - because it's just not a simple problem. It is not a simple thing to calculate up front. It's not a simple thing to keep accurate as the progress is happening.
The best we can hope for is a rough approximation - and ultimately that's what most progress bars do: kind of an okay job.
(Transcript lightly edited for readability.)
Next from Answercast 91- Why is my Hotmail login not being remembered?
Comments on this entry are closed.
If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.
If you don't find your answer, head out to http://askleo.com/ask to ask your question.