Raspberry Pi 2 vs. Raspberry Pi B+ & Beaglebone

About a month ago I published a comparison between the Raspberry Pi B+ and Beaglebone Black. It wasn’t very long after that that Raspberry Pi caused quite a hubbub with the release of the Raspberry Pi 2. This new little guy boasts 4 cores and an ARMv7 processor.

It took a while to get my hands on one, but once I did I wanted to run the same performance test that I did on the B+ and Beaglebone Black. This basic comparison looks at CPU performance while running a simple script.

Instead of messing with the settings and background tasks of the computers, I decided to run the test in their basic boot environment (command line, not GUI) for a more “practical” comparison (since you’d actually be using this environment for your projects).

I used the same script from my tutorial on monitoring computer performance to see average CPU usage before, during, and after running the stress test script.

If you’d like to replicate my test, you’ll need to install psutil with 

sudo pip install python-psutil

along with the Initial State streamer.

data streaming icon
software icon, code icon

My initial experiment was run on a Rasberry Pi B+ running Rasbian and an element14 Beaglebone Black running Debian. I then replicated it on a Raspberry Pi 2 running Rasbian. I tried to use various resources by having my test script ping Google, perform addition, stream to Initial State and append to an array in a tight loop.  To make things even more interesting, I also ran a trial with floating point division added in.

## Import subprocess to make calls like in the terminal
import subprocess
## Import the ISStreamer module
from ISStreamer.Streamer import Streamer

## Streamer constructor, this will create a bucket called Computer Performance
## you'll be able to see this name in your list of logs on initialstate.com
## your access_key is a secret and is specific to you, don't share it!
streamer = Streamer(bucket_name="Performance Test",access_key="[Your Access Key Here]",buffer_size=20)

## Initialize a number
numforstr = 12345

## Create an array
array = [str(numforstr)];

## Tight while loop b/c no sleep
while True:

	## Ping Google
	res = subprocess.call(["ping","-c","1","www.google.com"])
	## Add to our number
	numforstr = numforstr + 12345
	## Stream the current number
	streamer.log("Number",numforstr)
	## Add to our array
	array.append(str(numforstr))
	## Stream the last object in the array
	streamer.log("Last Array Index",array[len(array)-1])
	## Uncomment to perform division
#	div = numforstr/12344

To analyze my data, I used Initial State’s signal statistics.

These first three screenshots show the Pi 2, Pi and BBB’s CPU usage while no script is running.

Raspberry Pi 2 average CPU usage running boot environment. You’ll notice that it has multiple CPU cores!
raspberry pi performance, raspberry pi cpu statistics
Raspberry Pi average CPU usage running boot environment
beaglebone black performance, beaglebone black cpu statistics
Beaglebone Black average CPU usage running boot environment

The Raspberry Pi 2 is so cool because, as you can see here, it has 4 CPU cores. And it’s only using 2.5% of it’s CPU power at boot. The B+ was using 19% while the Beaglebone Black was using 25%!

The Pi 2 core percent use was 2.97%, 2.44%, 2.32%, and 2.27%, respectively, which averages out to the CPU total value of 2.5%.

I also wanted to see how much of a difference there was in CPU usage between the GUI and boot environments. I found that running the GUI only used 0.25% more power!

Raspberry Pi 2 basic CPU usage running GUI
Raspberry Pi 2 average CPU usage running GUI

Now for the stress test. Let’s run the test script without the division.

Raspberry Pi 2 average CPU usage while running script without division
raspberry pi performance, raspberry pi cpu statistics
Raspberry Pi average CPU usage while running script without division
beaglebone black performance, beaglebone black cpu statistics
Beaglebone Black average CPU usage while running script without division

So the Pi 2’s CPU percent went from 2.5% to 12.62%, which is still lower than the B+’s resting boot environment CPU percentage. The Pi B+’s CPU percent jumped from 19% to 64%, while the Beaglebone Black only went from 25% to 35%.

I pointed it out in my previous post, but Beaglebone’s usage appears much more ragged than the Pis’.  I’m still not sure why. The Pi 2’s usage only looks more ragged than the B+’s because it is showing a much smaller range (0-13 compared to 0-65).

Now let’s add some division.

Raspberry Pi 2 average CPU usage while running script with division
Raspberry Pi 2 average CPU usage while running script with division
raspberry pi performance, raspberry pi cpu statistics
Raspberry Pi average CPU usage while running script with division
beaglebone black performance, beaglebone black cpu statistics
Beaglebone Black average CPU usage while running script with division

Like with the B+ at 64.51%, the Pi 2’s average percentage stayed roughly the same at 12.46%.  The Beaglebone Black, however, made a 7% leap from 34.83% to 41.67%.  This higher percentage is still lower than the B+’s but more than 3x that of the Pi 2.

So for a brief recap in case you didn’t want to read all of that:

Raspberry Pi 2 Raspberry Pi B+ Beaglebone Black

Basic CPU Usage (Avg %)
2.50 19.07 25.25
CPU Usage During Script Run (Avg %)
12.62 64.38 34.83
CPU Usage During Script Run w/Division (Avg %)
12.46 64.51 41.67

Basically, the Pi 2 blew the other two away. And these numbers make perfect sense when you’re using the board itself. Navigating the GUI is so fast and fluid, and previously unusable websites work perfectly. The other big plus to having multiple cores is that threaded modules (like the Initial State Streamer) can actually run concurrently with other threads like they should.

This was a very basic test, but I felt like it was applicable to the sorts of programs you might be running for your single board computer projects. Psutil can give you a lot of information, so looking into factors other than CPU usage is also very interesting. Initial State also makes it really easy to see what happened and get quick analysis on your results.

If you decide to run some experiments of your own, be sure to let me know what you find!

12 comments On Raspberry Pi 2 vs. Raspberry Pi B+ & Beaglebone

  • Nice result…..still waiting for Pi2 to arrives. Don’t forget Pi2 has much larger RAM 1GB compare to 512M in Pi1.

  • Actually I’m very interested in running Java and JavaFX in Pi2.

  • This is great. More than x4 faster than B+. Hoping to give Initialstate a trial run in near future.

  • Performance is one angle to look at the things. Raspberry pi excels because of the wonderful eco system and communities it has created. We found it really useful when we started developing pi signage solution.

  • I hate to point out the obvious, but CPU usage is not in any way a measure of performance, or even necessarily related to performance when entirely different CPUs are being “measured”.

    Whatever might be taking up CPU time on an “idle” machine might entirely stop using CPU when real user jobs need more cycles.

    How about running a real benchmark program of some sort as a better measure of what each machine is capable of out of the box?

    Given the multi-core nature of these two new systems, perhaps sysbench (http://sysbench.sf.net) would be an appropriate choice.

    • I completely disagree. CPU usage is a common metric that is used to evaluate performance, especially in systems where you have multiple threads running or in a multi-tasking O/S. Processes that are taking up CPU time on an idle machine don’t just magically disappear once you start doing a real job (typically). The CPU has so many clock cycles available to it to do all of the math and operations that processes are asking it to do. Once your CPU is pegged at 100%, this becomes the gate to performance. Clearly, there are several other factors that affect performance for various applications such as memory bandwidth, network latency, video rendering, etc. This performance test is showing you what the Pi/Pi2/BBB is capable of “out of the box” when streaming to a cloud service while running some simple scripting operations – a very common use case.

    • @Greg: Yeah, I agree. This is a very weird way to measure performance. Since the machine isn’t using 100% of CPU on a task that’s computational in nature – it’s running a lot slower than it should. I’m not quite sure what it’s measuring – but it’s certainly nothing of practical importance.

      There are PLENTY of standardized benchmarks out there – use one of those rather than inventing your own.

      The key question here is why your benchmark program is using such a tiny fraction of the CPU time…it’s clearly not stressing the CPU – so what is it stressing?

      I don’t think this article is much help.

  • So that is why i now have 3. Oh noesssss.

  • Pingback: lucadentella.it – BeagleBone Green ()

  • Yes, by looking at CPU alone, the Pi2 runs circles around the Beaglebone Black. Now, how about native reading of a half-dozen analogue sensors while concurrently running a couple fixed address I2C-based sensors.

    OK. It’s an unfair test for the Pi2. But, the point is that each board has its use. I’ve been a fan of the Pi2, but am admittedly starting to work the Pi for testing, but the Beagleboard for testing. I expect there will soon be a a successor of the Bone Black with more memory and computing power (I don’t count the X-15).. A Beowulf stack of 12 will make for one really sick puppy.

Leave a reply:

Your email address will not be published.

Site Footer

Initial State