the shell team received two customer questions about a month apart which seemed unrelated but had the same root cause.
I found that in Windows Vista, the
xcopycommand is ten times slower than it was in Windows XP. What is the source of this slowdown, and how can I fix it?
We have an application which takes a very long time to start up on Windows Vista than it did in Windows XP. We noticed that the slowdown occurs only if we set the application to autostart.
Let's look at the second one first, since that customer provided a useful piece of information: The slowdown occurs only if they set the program to run automatically at logon. In Windows Vista, programs which are set to run automatically at logon run with reduced priority. This was done in response to the fact that application developers went angling for a bonus and decided to slow down the operating system overall in order to get their program to start up faster. To counteract this tragedy of the commons, the performance team runs these programs inside a job object with reduced CPU, I/O, and paging priority—which the performance team informally calls boxing— for 60 seconds, so that the user isn't forced to sit and wait for all these startup programs to finish doing whatever "really important" stuff they want to do.
Okay, back to the first customer, the one who reported that
xcopy was taking a long time. It took a bit of back-and-forth, but eventually the customer revealed that they were performing the
xcopy in a batch file which they placed in the Startup group. Once they volunteered that information, the reason for the slowdown became obvious: Their batch file was running inside the box, and consequently ran with low-priority I/O.
There is no way to escape the box, but it so happens that logon-triggered scheduled tasks are not placed inside a box. That's your escape hatch. Don't abuse it. (Of course, now that I've told everybody how to avoid being put in a box, everybody will now take advantage of it, because eventually, nothing is special any more.)
Oh, and if you look more closely at the
Delay_ setting on a Windows 7 machine, you'll see that it's set to zero, so the boxing behavior is effectively disabled on Windows 7. I guess the performance team gave up. "Fine, if you want your computer to run like a dog when it starts up, then go right ahead. I won't try to save you from yourself any more."
Bonus chatter: You can explicitly "put yourself inside a box" by using the
PROCESS_ process priority mode. Programs which are intended to run in the background with minimal impact on the rest of the system can use this mode.