Is the new Raspberry Pi 4 fast enough for gaming? And, if so, what sort of games can you play on it? This article will answer these questions, and show you how to improve performance and measure CPU speed!
Raspberry Pi 4: Fast Enough For Gaming?
The new 8GB Raspberry Pi 4 may have made a few heads turn when it came out. A cheap, small, microcomputer with desktop like capabilities and memory sizing. But is it good enough for gaming?
If you are ready to start playing around with a Raspberry Pi you just purchased, check out our How to Quickly Setup a Raspberry Pi 4 with Ubuntu 20.04 or 20.10 article!
The most pertinent question to address when it comes to ascertaining whether a Raspberry Pi 4 is good enough for gaming is whether it will be able to perform fast enough in various areas. The main areas to consider are disk speed, CPU and GPU speed, and the memory size and speed.
Let’s start the last one (memory) first.
Raspberry Pi 4: Memory Speed
The main memory size will be fixed by your original purchase. You may opt (or have opted) to go for the 4GB model, or perhaps paid a little more for the 8GB model. If you are considering using your Pi 4 for gaming, and haven’t purchased yet, perhaps it is better to spend a little more and get that extra memory as it may help significantly.
Not only by providing more memory room for your games and operating system to work with (usually resulting in faster performance), but also by providing you an additional option you may not have considered yet; running your games in memory instead of on disk.
As with all computers, each computer has multiple levels of caching. The fastest caches are even embedded in your CPU (Central Processing Unit) of your computer. They are called L1, L2, L3 etc. caches, or in other words Level 1, Level 2 etc. caches.
The higher the level number, the slower, but larger the cache. After the CPU cache, the fastest ‘cache’ or ‘memory’ is your main memory. Much larger then the Level x caches of your CPU, but also much slower.
After main memory, there is the disk. SDD disks, and some SD cards, can be very fast, and again often much larger then main memory, but almost always slower then main memory.
It is possible to assign part of your memory (let’s say for example 3-4GB out of the 8GB available) to become a ramdisk (a disk in memory). This ramdisk will be volatile (i.e. you switch your computer or Raspberry Pi off and all data will be gone!) but it will be much faster then your attached disk or SD card.
Thus, you can create a ramdisk in memory, copy your game to it, and then play from the ramdisk. Super fast!
As for actual memory speed – it is fairly fixed on Raspberry Pi’s. On your computer you may have many tweak and overclock settings provided in the mainboard BIOS interface, but for the Raspberry pi the overclocking options are mostly limited to the CPU and GPU. See Raspberry Pi overclocking options in config.txt for more information.
Raspberry Pi 4: Disk speed
The disk speed of a Raspberry Pi 4 is extremely variable between different options. If you spend extra money, and time researching, you can come up with disk speeds which may be almost as good as in a desktop.
If you take the cheap and easy route, disk speed may become a slight nightmare when trying to get a game to perform fast and well.
There is a large difference between a cheap $20 SD card (it will be slow!) and a fast SD card, optimized for write speed, at $200. Still more expensive are USB3 SSD enclosures with a SSD inside.
Hooking this up to the USB3 port of your Raspberry Pi 4 may provide a large amount of diskspace at fast I/O (input/output) speeds. Another interesting option here is to get a USB3-to-NVMe enclosure, and use an NVME drive, but note that some of those may run quite hot.
One recommendation here is to test some options and see what works best. If testing is cost-prohibitive, you may be able to compare benchmarks on online websites like for example UserBenchmark SSD Ratings.
As for reliability, Amazon reviews on various SSD’s provide plenty of ‘user stories’ which can help you weight up one drive against another.
And, as explained earlier, using a ramdrive may be another viable alternative – especially on the 8GB edition – provided that your game will easily fit into 3-4GB of memory, or better.
Raspberry Pi 4: CPU speed
Whilst cooling the CPU may not the most challenging issue, with a plethora of cases and even dedicated CPU coolers available, the actual speed of the CPU is going to matter.
Let’s do a quick sanity check CPU performance measurement, on a non-overclocked idle Raspberry Pi 4:
sudo apt install sysbench
sysbench cpu –threads=64 –cpu-max-prime=999999 run
We first install sysbench, and then we let it calculate all prime numbers up to 99999. The result:
While have purposely overloaded the Raspberry Pi with too many threads (the CPU in a Raspberry Pi 4 has 4 threads, and we are constantly trying to run 64 threads), this gives a good indication of the speed of the CPU under stress.
Let’s compare this with an Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz with 16 threads:
128 Events over 12.2810s (Raspberry Pi 4) versus 322 Events over 10.7433s (Intel i9-9900K)! Furthermore, the Intel machine was under other light load while the test was running. Quite a difference.
Still, the number is higher then expected and not bad at all given there are only 4 threads in the Raspberry Pi 4 and it is running at a much lower frequency then the Intel CPU!
Let’s do another test, using md5sum over random input, and loop this 1000 times. Note that this test is single-threaded.
time $(RANDOM=1;for((i=1;i<1000;i++)); do R=$(cat /dev/urandom|tr -d ‘