Raspberry Pi | 4 min | 13027
The new Raspberry Pi 4B has a lot of upgrades and one of the most important ones is the RAM: You can choose between three models (1GB, 2GB and 4GB). But, another main change is the CPU and the RAM bus: they changed from a Cortex-A53 64-bit (3B+/3A+) to a Cortex-A72 64-bit, both ARMv8, and from LPDDR2 SDRAM to LPDDR4 SDRAM. Thus, the CPU clock was increased to 1.5GHz (0.1GHz more) and the memory frequency to 2400MHz (1500MHz? more - I'm not sure if the 3B+ had a 900MHz bus, please comment if not.).
This is the first article of three in which I'll test the performance of the Raspberry Pi again:
- In this article, I will test and compare the CPU performance of the Raspberry Pi 4B+ (4GB) with the Raspberry Pi 3B+ (1GB). In June, Raspbian Buster was released. Thus, I will test the performance using Raspbian Buster on both boards.
- The second article
will beis a comparison using standard and preempt-rt kernel. The new board uses two separated chips for the USB and the ethernet network ports. Thus, it could be that the performance of the preempt-rt kernel is not affected anymore by the USB-IRQ. Here the article: #Raspberry Pi 4B: Preempt-RT Kernel 4.19.y - Performance Test
- The third article
will includeincludes a performance test using some cooling options like the ICE-Tower CPU Cooling: #Raspberry Pi 4B: Sometimes it's cool to be hot -or warm, to be exact ;)
Hardware & Software
In this article series, the following software and hardware will be used:
Again, I used Visual Studio Code (VSC) and the Remote-SSH extension (read the VSCode part of this article) to connect to the Raspberry Pi and install Python3-pip, git and the Python3 needed extension as:
pi@raspberry:~# sudo apt-get install python3-pip git pi@raspberry:~# pip3 install tqdm
Then, the performance of the Raspberry Pi 3B+ and 4B resolving the N-queens problem (multi/single-thread) can be measured using the following code:
pi@raspberry:~# git clone https://github.com/lemariva/N-Queens-Problem.git pi@raspberry:~# cd N-Queens-Problem # multi-thread (N=12, Threads=4, Repetition=100) pi@raspberry:~/N-Queens-Problem# python3 queenpool_multithread.py multithread_output.csv 12 4 100 [...] # single-thread (N=12, Threads=1, Repetition=100) pi@raspberry:~/N-Queens-Problem# python3 queenpool_multithread.py singlethread_output.csv 12 1 100 [...]
The results for the multi-thread configuration were the following:
Fig. 2a: Raspberry Pi 4B - Multi-thread Configuration Fig. 2b: Raspberry Pi 3B+ Multi-thread Configuration
The new Raspberry Pi 4B was able to solve the 100 iterations 2.30x times faster than the Raspberry Pi 3B+. The CPU was ca. 4°C warmer than the previous model. Additionally, it can be seen that Raspbian Buster was also optimized. A similar test on the Rasbperry Pi 3B+ with Raspbian Stretch and Kernel 4.14.27-v7+ took about 103.50 min to resolve the 100 iterations. This could also be related not only to the Raspbian version but also to the Python version (v3.5 on Stretch, v3.7 on Buster). Moreover, the maximal temperature from 3B+ with Raspbian Buster was approximately 9°C warmer than with Raspbian Stretch.
The results for the single-thread configuration were the following:
Fig. 2a: Raspberry Pi 4B - Single-thread Configuration Fig. 2b: Raspberry Pi 3B+ Single-thread Configuration
The new Raspberry Pi 4B was 2.55x faster than the Raspberry Pi 3B+ in the single-thread configuration. And again, Raspbian Buster (or Python 3.7) seems to be optimized also for single-thread operations. The average time for a single-thread solution was about 43.38 seconds faster! The new CPU was also warmer and Buster allows more higher temperatures on the 3B+ CPU.
The main statistic values are displayed in the following table:
Avg. Multi-Thread Solving Time 21.79 s 49.83 s 62.66 s 70.85 s Multi-Thread Max. Temperature 81.40 °C 77.63 °C 68.78 °C 78.69 °C Avg. Single-Thread Solving Time 66.72 s 169.96 s 213.34 s 251.30 s Single-Thread Max. Temperature 67.09 °C 60.39 °C 54.22 °C 52.61 °C
csvfiles and the related Jupyter Notebooks are available on lemariva/rPI-Tests for analysis.
There’s no denying: The Raspberry Pi 4B is an impressive embedded system that is 2.30x and 2.50x faster in multi-thread and single-thread configurations than the Raspberry Pi 3B+. While the performance reduces with the temperature, same behavior can be seen in the previous version of the board. A small heatsink attached to the top of the SoC helps to dissipate the heat and the obtained performance is outstanding.
The OS update (or the newer Python version) also helps to increase the performance of the boards. Moreover, the maximal reached temperature is almost 9°C higher with the new OS, which can be a problem in projects that put a frequently-loaded Raspberry Pi into an enclosed area. I don't understand the temperature difference between Raspbian versions. The model 3B+ was advertised saying it had better thermal capabilities than the model 3 due to the SoC encapsulation. I could verify that with Raspbian Stretch (see table: -10 °C and better performance). Now with Raspbian Buster, the temperature of 3B+ reaches what the 3B had. Its performance increases (12.83 s), but it seems a bit strange for me. Maybe the temperature limit for the 3B+ was set lower for Raspbian Stretch.
To sum up, if you have a Raspberry Pi 3B+ and need more computing power, and do not have a problem with the USB-C power connection or with the mini HDMI ports, buy this monster ;). It is really justified to do that! :)
Stay tuned for the next articles on the performance of the Raspberry Pi 4B!