Loading times

Posted on . Updated on .

Since the invention of the personal computer, the speed and capacity of those machines have been improving a lot and they are now much faster and better than they were many years ago. These performance improvements have affected several components. The most important ones for general usage nowadays are the CPU and the memory system, which includes the different CPU cache memory levels, the RAM memory and the hard drive. The increase in performance has been bigger in the components closer to the CPU. Hard drives have had many speed improvements in access, read and write performance, but it’s next to nothing compared to the improvements in the CPU speed.

If we don’t take into account the latest MS Windows version and some special types of programs like 3D games, in my opinion computers have been good enough for a few years now. Any computer built, let’s say, in the last four years, is able to run Windows XP or a decent Linux distribution with an office suite, a communications suite and several other programs without any problems. You can have them running at the same time in your computer and they don’t bring it to its knees. Right now I’m typing this from a laptop computer with a single-core Sempron CPU, 1 GiB of RAM and a 60 GB hard drive. The majority of the hard drive space is being taken by personal data like pictures and videos, not the system itself, the CPU is being barely used at this moment and I have a Slackware Linux system running with the latest KDE 3.x, Kontact (a communications suite with calendar, to-do list, notes, e-mail, etc), Mozilla Firefox and several other programs. The amount of memory being used by the applications, according to the KDE Information Center and the "free" tool, is about 160 MiB. I could perfectly run OpenOffice.org too if I wanted and still not use any swap memory. There’s plenty of memory available. And that’s what most computers are being used for. Be it at home or in offices, they are used to browse the web, communicate using email or IM programs, send and receive files, watching pictures and videos and composing documents.

All these improvements have allowed us to create more complex systems, normally with the single purpose of making other people’s lives easier, starting by the people who create the software itself. In the early days you couldn’t do this, but now you can have libraries, and more libraries on top of them, and a third library layer and a lot of abstractions and a complete API so writing an application becomes much easier. This means that the application is easier to maintain and easier to create, and those two tasks take less time and effort, allowing the software to be cheaper and more easy to use, because once you have a solid framework to work fast, you can concentrate on other types of improvements like making the application easier to use or more intuitive.

So we know that, for now, we don’t need much more computing power in most cases, and we can guess there is not much room for making a word processor or web browser better. They are what they are. You can point and click, save bookmarks, type seeing how the document will be on paper, correct mistakes before printing it on paper, save a lot of time by creating and applying styles, make it create and update a table of contents automatically…​ so where can we improve? Is there anything in which we haven’t seen a real improvement? Something we should have paid a little bit of attention to and we didn’t? Some unavoidable problem derived from all of this that we could try to solve? In my opinion, yes: the loading times. There’s a system with several layers of libraries and other software in the middle and at the top of it there’s an application. That complex base makes it easier to write and maintain the application, but it also means it’s bigger byte-wise, more things need to be initialized and read from disk, and while the systems we have are perfectly capable of running everything we need to run at the same time, it still takes too much time to get the program started. Once it is running, fine. While loading, not so fine.

The time it takes to boot an operating system today is worse than it was in the early days, due to the number of systems that need to be initialized and the incredible variety of the hardware it needs to detect and support, among other factors. The first Unix systems booted in seconds. Now they may take minutes. This is an obvious problem, and people have been trying to solve it and improve the situation in the latest years. Windows XP takes less time to boot than Windows 98, normally. Ubuntu Linux, for example, is now trying to move away from the classic SysV init (and others) and replacing it with "upstart", to boot more efficiently. Someone invented "suspend to RAM" and "hibernate". In the first case that means booting in a few seconds to a completely usable system with everything started and ready to run, as we had it running before. Windows has SuperFetch, based on the standard Windows Prefetcher, which can be tweaked through the registry in Windows XP, for example. Linux has Preload and Prelink, and Mac OSX had Prebinding, according to the Wikipedia now abandoned because it didn’t really give noticeable performance improvements.

So, yes, people have been well aware of the loading time problems and have been trying to create hacks and find ways of circunventing the problems derived from having a complex base system that makes our lives easier. For some types of applications, loading times are not a problem. For example, I can start an XTerm with Mutt almost instantly once the files are in the disk cache (in memory). Yet KMail takes several seconds to load, even when it’s already cached. Which one will I use? While Mutt is no worse than great, and I say it from my own experience, it doesn’t have many very useful features KMail has (God bless the quick search bar), and I’d prefer to use KMail if possible. Firefox takes four seconds to start in this machine when cached, and OpenOffice.org…​ let’s not go in there. Once they are running, no problem, I have plenty of memory available. Like I said, the problem lies in the loading time.

The approach I use to minimize this problem is relatively simple. You may have your own, here’s mine. I use suspend-to-RAM as much as possible. It takes a little bit of power but, let’s face it, "booting" in 5 seconds to a completely prepared system is a very spectacular and real improvement. On top of that, I noticed some time ago that KMail had an option to place itself in the system tray, invisible until you clicked on it (Windows users can take uTorrent as an example of this behaviour), and when you use it that way and want to write an email, you just click on the system tray icon and it comes back instantly. When you close the window, it goes back to the system tray instantly. Instant-on and instant-off. This is the obvious solution. If we have a lot of memory and running all of them at the same time is not a problem, yet the loading time for many of them is a problem, you do the obvious: keep all of them running all the time. If you use suspend-to-RAM too, they can run for ages, only stopping at the eventual reboot that comes with some system upgrades (like kernel upgrades in the Linux case). As I launch them when I enter my session, their total launch time is added or accounted as part of the boot time, but real reboots are only needed once in a blue moon. Some applications have a built-in system to do this, like I mentioned uTorrent, KMail, but also OpenOffice.org for Windows (and maybe Linux, I don’t remember) has a pre-load system, and Firefox had (or has?) a similar system under Windows. Some of them don’t have it, but they are not a problem provided you have tools like "ksystraycmd", a KDE tool that will allow you to place any windowed program in the system tray. Thanks to it, Firefox starts and stops instantly too, as well as other applications (I could use it with OpenOffice.org Writer and Calc if I used them frequently). Some of you may be wondering what’s the difference between this and keeping the application minimized. The answer is that while the application sits on the system tray, it doesn’t appear in the task bar and it’s not present, for example, in the Alt+Tab menu. So when you send it to the system tray, you can effectively forget about it, and it doesn’t interfere in your usage of other programs you may be running at a given time. When you bring them back from the system tray you can minimize them like other applications, or keep the window open, yet you can at any time say "I’m done for now with it, so put it somewhere else until I need it again in 15 minutes". This separation of concepts between "minimization" and "iconification" (to the system tray in this case) also marks the difference between this tool and other iconification systems like the ones from CDE or WindowMaker, where "iconification" is only an aesthetic difference to "minimization", in the sense that iconified windows are still considered active, and iconifying a window is the only way of hiding it.

KDE systray and applets

There is also a very interesting application called Yakuake, which is a Quake-console-style terminal application for KDE. It sits invisible on the top of the screen until you press a hotkey or key combination and then it comes down. It’s very efficient in order to have a terminal permanently running. Some time ago the main Yakuake developer was considering extending this functionality beyond terminals, and make Yakuake handle any type of application, so you could bring any application down with the appropriate hotkey and keep them running all the time. When I read about it I didn’t give it much importance, but now I do and I think that was indeed a great idea, that probably won’t be implemented any time soon. With the arrival of KDE4, maybe it will now be easier to write such an application. I imagine having a very thin top screen bar with several applications that can notify me of activity through that bar (like KMail getting new mail), they can only be brought down using a key combination, without interfering with the other active applications from the taskbar. I think that would be very nice, practical and a good way to have instant on and off for a defined set of applications. Who knows. Maybe some decent programmer (or me if that fails) will create such an application in the future.

Keeping an application running all the time only has one problem: sometimes the application is not very nice on the system memory or has memory leaks (there are many claims on Firefox having serious memory leak problems, but I haven’t noticed any real ones — I use the Flash and MPlayer plug-ins and the Flashblock extension). To keep an eye on that, KDE has a very nice applet to monitor CPU and memory usage at a glance from time to time. Remember: your computer has a lot of memory, so make good use of it. Nowadays, when someone buys a new computer they expect very short loading times and everything starting in a fraction of a second (like in movies). There are a few tools and tricks which can help you achieve this goal most times, so give them a try.

Load comments
Please enable JavaScript to view the comments powered by Disqus.