Next UAC takes like hours when I try to open OrcasBeta1VSTS_VPC_8PartsTotal.part01.exe (the first file of the Orcas Beta 1 SFX RAR archive) -- it is 700 MB, but why does UAC take that long? CPU doesn't even go up... Looks like a bug to me! I have no AV installed!
The problem here is quite subtle.
When you open an executable file, the process manager has to load the entire program out of memory before it can execute it, which for 700 megs can be a reasonable amount of time, but is still less than a second.
The problem now is that UAC needs to discover whether it should ask you for a permission hike. The best way is to scan that 700 MB for the manifest file. If this is near the beginning (i.e. is a vista file with embedded manifest) and this returns
, then we just set up the process and away we go.
If there is no
manifest, we scan the entire file. This can take some time, but is still only in the region of 400ms per gig of executable. If we don't need to elevate permissions, then we can now set up our process nearly a second after we double clicked.
The real problem comes if we do
need to elevate permissions.
Firstly there is no way to send user-level memory to administrator-level memory. This means we immediately dispose the 700 MB of user-level memory and set up a new process in administrator memory and reload the file. There's another second gone.
But wait, it gets worse. Because UAC is actually a second process, if too much time elapses between when it wants to start up and when it gets to the point where UI is available, any user interaction might force focus elsewhere - and this means that the UAC
Which means that for large executables with no embedded manifest which need elevation, you might end up waiting 3 seconds or more to see that anything at all is happening, and even when you do you might have accidentally minised the UAC dialog, and you'll then
need to wait for the toolbar icon to appear before you can get on with your program.
Small executables = very fast.
Executables with manifests and no elevation = very fast
Executables with manifests and elevation = slow
Executables with no manfiests and no elevation = fast
Executables with no manifests and elevation = very slow.
Btw, a good way of speeding up admin-needing apps with no manifest is to open a command window with admin permissions (small exe = fast) and then ask it to open the offending app, which gives it admin permissions by default, and can therefore just run the damn
app. If you're making a big app (>100mb) that needs admin permissions and isn't an installer, split it in half, and get the first one to get admin permissions and immediately launch the second half.
I've just realized I've replyed to a eight month-old thread. Stop necrobumping!!