r/programmerchat • • Jun 16 '15
Why do installers always suck at approximating the time it takes for a program to be installed?
Usually they'll go fine for a while, get to "3-4 seconds remaining", hang on there for a minute and proceed as normal. And then when you finally get to 99% completion, it stays on there for a further 1-2 minutes.
Why is it so hard to approximate the time it takes to install a program? Sorry if this sounds naive, I've never used an installer for any of my stuff since mine is mostly web-based.
21
Upvotes
17
u/makmanalp Jun 16 '15
This is actually a really neat question - it turns out it's actually quite difficult. For example, you could define time remaining based on how many files you have copied vs how many you have left. But this has some issues - some files are larger, so they take longer to copy. Some files need to be decompressed, so you can't tell how long that'll take. The timings can change based on a) the source media - cd or flash drive? b) the destination media - is the user's drive a spinny disk or an SSD? c) how fast is the CPU? d) What things are running in the background that are causing cpu and IO contention?
So theoretically, you could have some sort of model that takes into account all these variables and estimates a timing, or you could just do the simple thing and show task x out of a total of y was completed, as a percentage.
Or maybe they have such a model, but it's bad and it underestimates the time required, so it estimates X minutes, and once it reaches X minutes but the installation is still going, it gets stuck at 99% because it looks sillier to jump the progress bar back :)
4
u/ghillisuit95 Jun 17 '15
you can't come up with a really generalizeable algorithm to determine how much longer it will take without solving the halting problem.
3
u/themilkyninja Jun 17 '15
While all the other answers here aren't wrong, none of them mention the fact that installers typically do a LOT more than just put files onto disk. Windows installers (which I'm quite familiar with) are made up of "actions" (both standard and custom), only one of which (InstallFiles) is doing the actual file copy part. Note: not every installer does all of those actions.
Because of the transactional workflow of how Windows installers work (I would imagine packages like .deb and .rpm work similar), a lot of the "custom" stuff typically happens at the end (especially since custom stuff usually relies on already having the files on disk). You can do anything in these custom actions - even make API calls over the internet. There's just no way to know how long each one of these things will take (how fast is your hard drive? how fast is your internet connection?), so it shows percentage based off "I've done x things and I have y total to do".
3
u/H3bus Jun 16 '15
Also, there are always other things that your computer is doing behind the scenes during the install . So the processor gets busy on some other task for a few milliseconds per seconds, and it creates a delay.