Improving the Perception of Speed

Speed, responsiveness, and the perception of speed are different. When the user issues a command, speed relates to the time it takes to complete the command, responsiveness is the time it takes to respond to further user input, and the perception of speed is determined by how much the user notices each of these.

You can often improve responsiveness by using multiple threads of execution. (Note that multithreading does not improve the speed on a single CPU computer, just the responsiveness.) A good example is the print spooler in Windows. When you print a large document, Windows spools the document to a metafile and returns to the program quickly, even though it might then take several minutes to print the document. Another example is Windows Explorer's handling of the display of program icons. For program files, Windows Explorer reads a program's resources to extract the program icon, which can take a fair amount of time for hundreds of files. Yet if you display the Windows system folder (which typically has hundreds of executable files) using Windows Explorer, the program is immediately responsive. This is because the program icons are loaded in a separate thread on an as-needed basis. While multithreading can be useful, you should use it sparingly since using it adds to the complexity of the code and can introduce bugs that are next to impossible to reproduce while debugging. A simple alternative to multithreading is to perform processing during idle time, such as with the MFC CWinApp::OnIdle function.

You can improve the perception of speed in several ways. One common way is to change the order in which windows are drawn by using the UpdateWindow function. For example, if a command results in four windows being repainted—one that is slow and three that are fast—the repaint will seem faster if the fast windows are redrawn first. Similarly, a command will be perceived as slow if a window remains invalidated for a long period of time. The command will be seen as faster if the window is repainted first and then the command is performed.

Another way to improve the perception of speed is to give progress feedback using something other than a wait cursor. For example, if you copy many files using Windows Explorer, you get this progress dialog box:

This progress feedback has several advantages: it indicates how long the command will take, it shows how much work has already been done, it confirms that progress is being made, and it gives the user the opportunity to stop the command. Most of all, it is engaging enough to help the time pass faster. Note that the wait cursor has none of these benefits. Also note that displaying this progress dialog box would be overly distracting for quick commands, so it appears only if the copy takes more than about five seconds.



Developing User Interfaces for Microsoft Windows
Developing User Interfaces for Microsoft Windows
ISBN: 0735605866
EAN: 2147483647
Year: 2005
Pages: 334

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net