Desktop painting

Painting in the browser can be costly, but we tend to forget that the browser isn't the only place where it can occur. By testing the limits of the browser capabilities, we sometimes ignore the fact that OS resource usage and machine configurations also affect browser rendering. That these remain outside our control doesn't mean that we should neglect them during development. Otherwise we may reach the limits of the possible sooner than we thought, which will lead to a browser crash.

The browser exists thanks to the operating system, which can affect its painting and even terminate it. If we assume for a second that we have a transparent browser window, then everything underneath will need to be rendered too in order to be visible. In this case, painting the browser and the underlying windows, including the desktop, is a task that may require time sharing of the available machine resources due to the competitive environment in which the rendering occurs. When we resize the browser window and make it smaller, the painting costs inside of it will decrease due to the smaller painting area and the fact that fewer pixels will need to be updated during page loading, scrolling and general user interactions with the page. But the painting area outside the browser increases and because the nature of the resize event is to fire continuously, the cost of the desktop repaint will be introduced to the system, multiple times per second. If we have a huge background photo with lots of icons and text labels that have to be anti-aliased, these costs may slow down the system and thus affect the rate with which we can continue to resize the window.

Every time we minimize or maximize the browser window, we reveal or hide the desktop. The browser window and its content have to shrink/grow and the visible desktop area has to grow/shrink. Animating this process will invoke repaints for every step of the transition between the minimized and maximized states. If we disable these animations, we'll have to repaint only once for each of these two states, which can eliminate lots of calculations. The user may think that the browser responds slowly to interactions and direct manipulation, whereas the possible cause for the bad experience—an overloaded desktop—seems to be standing still.

By preserving window contents while dragging, we make desktop repaints even more obvious. If we are moving the window fast, we can see for a millisecond how the surrounding area (on the desktop) is wiped out until it starts to gradually reappear, following the direction of the movement. In some instances, we can literally "clean" our desktop to the extent we can't see anything on it. To force it to repaint, we can toggle "show desktop" again. But this shows that painting in the browser doesn't occur in isolation.

What we can do to ensure minimal painting costs is to clean our desktop and replace any heavy background images with a single, solid color. Keeping most of our data files on a separate partition and not in subfolders on our desktop allows us to minimize the burden on the OS. When we need these files, we can explore them trough a single window that we keep minimized. Hiding files isn't as hard as it seems—some of them we need rarely, others can be deleted, system icons can also be hidden. Program icons also don't have to be spread on the desktop just to be made directly accessible. We can put all shortcuts in a single folder labeled "Programs" and install a program like Launchy, where we specify the location of this folder. After the file index is created, we can start programs by showing Launchy with <Alt>+<Space> and typing their name. Programs are almost immediately recognized and we can simply press <Enter> to start them. This effectively hides Launchy, but the options allow us to do the same when it loses focus, which is convenient.

We can use the desktop as a file distributor in our system. As soon as new files arrive, we can decide what to do with them. We can use them, transfer them to the appropriate directory if they have long-term value or delete them when they are no longer needed. This eliminates the case where we have many files in a directory that we see rarely and fear to clean up, because we have lost track what was valuable after it was used, but not deleted. On the desktop, new files are always in front of us, directly contributing to visual disorder, which stops our willingness to download more. To keep the space clean, we have no other option except of acting on these files immediately.

By cleaning up the desktop, we eliminate distractions during our work, minimize painting costs for window operations that also affect the browser and finally, we eliminate the possibility that excessive number of files will slow down our system over time.