Optimize Your Pi for Better Performance
HAS YOUR RASPBERRY PI SLOWED DOWN? It’s a common problem—it doesn’t matter which version of the Pi you’re using, performance always suffers if the operating system isn’t correctly configured. Using a lightweight operating system such as Raspbian Lite, DietPi, or piCore can help, but there’s much more you can do. Performance boosts can be gained from overclocking, changing how RAM is used, and ditching bloatware, among other things. –CHRISTIAN CAWLEY
1 POWER RANGERS The wrong power supply can wreak havoc with the performance of your Raspberry Pi [ Image A]. With insufficient power to deal with processing requirements, bottlenecks can occur, slowing the computer right down. Low power can also result in read/write issues, which in turn can damage the microSD card (more on that later). Then there’s the usual end result of a frozen Raspberry Pi: pulling the power lead and rebooting.
>> To avoid this, you need to give the Raspberry Pi a reliable power supply. This means using a good-quality PSU (if not the official device), rather than a spare USB port on your PC, TV, or power bar.
>> The official Raspberry Pi power adapter has a 100–240V input, and a 5.1V 2.5A output. If you’re not using the official PSU, ensure that your supply matches this, and that the micro-USB cable is of good quality, in working order, and fits the Raspberry Pi correctly.
2 SUPER-SIZE PI Using Raspbian Lite or some other lightweight distro is a good option for a stripped-back experience, but if you’re looking for a more feature-packed operating system, the standard Raspbian installation is your best option.
>> A full gigabyte of storage space can be freed up by removing unused tools such as LibreOffice, the Wolfram Engine, Minecraft, and Sonic Pi. To benefit from this fully, however, you need to have the full capacity of the SD card. This means using the “Expand Filesystem” option in the raspi-config tool, or the “Raspberry Pi Configuration” menu on the desktop. You’ll find this on the “System” tab.
>> Removing what might be unfairly termed “bloatware” on Raspbian is easy. Open a terminal prompt and type: sudo apt purge libreoffice* sudo apt clean sudo apt autoremove >> This removes LibreOffice from Raspbian. Replace the libreoffice* command with wolfram-engine , minecraft-pi , and sonic-pi to remove those tools. >> With these four options removed, you’ll have the advantage of increased storage space on your Pi without having the limitations of a lite distro.
3 KILL JAVASCRIPT DEAD While it’s wise to limit the number of tabs you have open in your preferred web browser, further performance boosts can be gained by disabling JavaScript. How you do this varies according to browser. In Chromium, use “Menu > Settings > Advanced > Privacy and security > Content settings > JavaScript.” Here, you need to switch “Allowed” to “Blocked.”
>> Disabling JavaScript can improve your overall performance, as well as speed up any pages that rely on it. While this might mean that pages become less functional, it will also help to reduce the load on your Raspberry Pi from advertisements and trackers. Note that exceptions can be added to your browser settings to allow JavaScript to run on specific sites. 4 OVERCOME WITH AN OVERCLOCK Massive performance boosts can be enjoyed by your Raspberry Pi by overclocking the processor. Raspbian offers this as a built-in feature that can be found in the raspi-config tool (other distros may require additional software). Access the overclocking tool by selecting “Overclock” on the main raspi-config menu. Depending on your Raspberry Pi model, you’ll have several
options here. The default option is “None,” with the clock running at the basic 700MHz, but you could ramp things up to 1,000MHz and above with Turbo mode.
>> Using the overclocking menu means you can avoid having to worry too much about stress testing, as the values on offer have already been tested. However, Turbo mode might cause problems, so it’s a good idea to use a cooling solution.
>> With a Raspberry Pi 3 and above, you can also edit the config.txt file in nano to specify values for the four overclock settings: “arm_freq,” “core_freq,” “sdram_freq,” and “over_ voltage.” The usual overclocking rules of taking a baseline reading and increasing incrementally apply.
>> The benefits of overclocking your Raspberry Pi include increased performance for video decoding in Kodi, or playing more games from the fifth- and sixth-generation consoles that can currently be emulated on the Pi. Emulation of Windows apps with the ExaGear software is also improved.
5 DITCH THE CHEAPO SD CARD Finding the right microSD card for your Raspberry Pi can be tricky, but with the right capacity and speed, it can make a huge difference to how your Pi runs.
>> The secret here is to stick to named brands, such as SanDisk, Samsung, and Kingston, while keeping an eye on the card’s speed and rating. A higher rating indicates better speed and error connection, which will improve your Pi’s performance.
>> Once you’ve added a quality SD card, it’s time to start looking after it. By now, you should know how to correctly shut down a Raspberry Pi. Doing so prolongs the lifespan of the SD card, saving you further outlay (however inexpensive a replacement might be), and the fuss of setting up your Pi again from scratch.
>> From the desktop environment, be sure to shut down from the main menu. If you’re using a Kodi media center distribution or a retro gaming suite, take the time to find the appropriate shutdown option, and use it.
>> If it’s quicker, or you’re connected to your Pi over SSH, it’s easier to shut down from the shell:
sudo shutdown -h now
>> You can also schedule a time to shut down the Pi:
sudo shutdown -h 02:46
>> An orderly shutdown ensures your SD card’s integrity is maintained, as well as avoiding data loss.
6 ZIPPY ZRAM RAM configuration options for the Raspberry Pi mean that you can easily designate a portion of RAM to the GPU if necessary, or reserve it for nongraphics tasks [ Image B].
>> Using the “Advanced Options” sub-menu in raspiconfig, find the “Memory Split” option, and use it to specify how much memory the GPU should have. For example, if you’re not using a desktop environment, you can set this to 16MB, allowing the Raspberry Pi’s processor to benefit from extra memory. For graphics-intensive tasks, however, your GPU needs more of the RAM. Note that even with a Raspberry Pi 3 B+ (which has 1GB of RAM), you can’t assign more than 256MB to the GPU.
>> Perhaps the best performance tweak for the Raspberry Pi can be made to the RAM, utilizing unused space for swap data.
>> As explained by YouTuber NovaSpirit Tech, ZRAM can be used as a swap disk. While the data won’t persist following a reboot, this can speed your Raspberry Pi up considerably.
>> Begin by grabbing the script from GitHub: sudo wget -O /usr/ bin/zram.sh https://raw. githubusercontent.com/novaspirit/rpi_ zram/master/ zram.sh
>> Next, make the file executable, and edit “rc.local” to run the script when you reboot: sudo chmod +x /usr/ bin/zram.sh sudo nano /etc/rc.local
>> Look for the exit 0 line, and above it add:
/usr/ bin/zram.sh &
>> Hit Ctrl-X to save and exit the file. ZRAM swapping is far faster than relying on even the fastest microSD card, with an instant performance boost.