Everyone wants software to get faster. Specifically, everyone wants the software on their machine to be faster so they can do things quickly and efficiently. On Linux, there are plenty of ways to to improve your experience if you’re willing to do the work.
I have had the pleasure of using Linux for many years now, and I’ve collected some tips from around the ‘Net and made some observations of my own on speeding up my system. Now I’ll pass on some of this information here, albeit a bit scrambled. Hopefully someone will find it of some sort of use (that’s the plan, right?).
Compiling Source vs. Downloading Binaries
When dealing in Linux-based operating systems, you have the option either to download software in binary form (pre-compiled, the way most software is distributed on Windows), or download the source code and compile it yourself. What difference is there between these two options, though?
Let’s start with a brief overview of CPU architectures. These days, 64-bit processors are becoming more popular. 64-bit CPUs generally have support for 64-bit instruction sets and extensions. For example, you might see the term “x86” for a 32-bit processor or operating system, while the term “x86-64” might appear if you’re using a 64-bit processor and operating system. This term specifies the architecture upon which your CPU is based. As you might guess, x86-64 implies an x86 architecture with 64-bit extensions.
Most modern CPUs support more than the traditional x86 instruction set, however. For example, many of today’s CPUs support the SSE series of instruction sets. These instruction sets include routines designed for performing many specialized operations. For example, the original SSE instruction set includes assembly routines specialized for floating point math operations. As a result, CPUs that support SSE can perform functions involving float point numbers more efficiently.
When you download a binary to your computer, it’s been compiled and built elsewhere on another person’s computer. In order to ensure compatibility across a wide range of machines, however, developers will target only a general architecture when compiling these binaries for distribution (that is, they will target the x86-64 architecture but maybe not a specific instruction set such as SSE). So really, the binary software you download is not optimized for your machine, probably resulting in a slower experience. (It’s got maximum compatibility at the cost of maximum performance.)
The importance of taking these extra CPU features into consideration when compiling software can mean the difference between a slow program and a speedy program. A program targeted at a general population of CPUs might take tons of instructions in order to perform a function, while a program that is compiled with support for a specific instruction set might be able to perform that function with less instructions, generally resulting in a faster execution time.
I won’t go into the details of compiling software specific to your hardware here, as I believe that would take an article all on its own. If you are able to install and configure Linux, however, you should be able to easily figure out how to compile software yourself with the assistance of Google and Linux’s supportive community.
For the more advanced power users, you can try to compile your own kernel. In that case, you’ll want to include the BFS patch. This patch will tune the way the kernel schedules processes, making things appear smoother for desktop users. In addition, you should generally configure the kernel to optimize for speed, rather than size (
-O2 rather than
-Os). There are some instances where optimizing for size is actually faster, however, it depends on the scenario. This is obviously not the place for me to explain the entire process of compiling a kernel yourself, so I would recommend you check out documentation specific to your distribution.
Reducing Swap Usage
If you’re hip on the computer lingo, you’ve probably heard the term “swap” thrown around by now. When your computer runs out of RAM to store temporary data, but it still needs memory to allocate to programs, it will usually resort to using swap space, which is space on your hard drive then set aside as memory for programs.
Swap space has a nasty side, though. The typical hard drive today is awfully slow — many magnitudes slower than RAM, and even more magnitudes slower than the caches and registers you would find in the CPU. As a result, if your computer resorts to using swap space, you will find that the program you’re using (or even the computer as a whole) probably lags terribly.
Luckily, nowadays, memory is cheap. We’ve gotten to a point where you can get many gigabytes of RAM for less than $100. I just picked up 16 GB for $60 ($30 after I applied my Newegg gift certificate). That’s simply mind-blowing considering 16 GB was a mere pipe dream not too long ago. From my experience, I would say that you no longer need swap space once you have 8 GB of RAM. In that case, you can tell Linux to stop swapping data through the following command in the terminal:
echo "vm.swappiness=10" > /etc/sysctl.d/20-swappiness.conf
This should suffice for most Linux distributions. If you’re unsure, Google around to see if there are specific instructions for your distribution.
So there are some of my tips for speeding up your Linux installation. Hopefully you are adventurous enough to do a bit more research on these topics and attempt to try them out yourself. Using Linux is a great learning experience, but you’ll only learn if you try.