I have experimented a bit with Node.js and Raspberry Pi lately, and I have found the performance… surprisingly bad. So I decided to run some standard tests: benchmark-octane (v9).
Octane is essentially run like:
$ npm install benchmark-octane $ cd node_modules/benchmark-octane $ node run.js
The distilled result of Octane is a total run time and a score. Here are a few results:
OS Node.js Time Score QNAP TS-109 500MHz Debian v0.10.29 (Debian) 3350s N/A Raspberry Pi v1 700MHz OpenWrt BB v0.10.35 (self built) 2267s 140 Raspberry Pi v1 700MHz Raspbian v0.6.19 (Raspbian) 2083s N/A Raspberry Pi v1 700MHz Raspbian v0.12.2 (self built) 2176s 104 Eee701 Celeron 900Mhz Xubuntu v0.10.25 (Ubuntu) 171s 1655 Athlon II X2@3Hz Xubuntu v0.10.25 (Ubuntu) 49s 9475 MacBook Air i5@1.4Ghz Mac OS X v0.10.35 (pkgsrc) 47s 10896 HP 2560p i7@2.7Ghz Xubuntu v0.10.25 (Ubuntu) 41s 15450
Score N/A means that one test failed and there was no final score.
When I first saw the RPi performance I thought I had done something wrong building (using a cross compiler) Node.js myself for RPi and OpenWRT. However Node.js with Raspbian is basically not faster, and also RPi ARMv6 with FPU is not much faster than the QNAP ARMv5 without FPU.
I think the Eee701 serves as a good baseline here. At first glance, possible reasons for the RPi underperformance relative to the Celeron are:
- Smaller cache (16kb of L1 cache and L2 only available to GPU, i Read) compared to Celeron (512k)
- Bad or not well utilised FPU (but there at least is one on the RPi)
- Node.js (V8) less optimized for ARM
I found that I have benchmarked those to CPUs against each other before. That time the Celeron was twice as fast as the RPi, and the FPU of the RPi performed decently. Blaming the small cache makes more sense to me, than blaming the people who implemented ARM support in V8.
The conclusion is that Raspberry Pi (v1 at least) is extremely slow running Node.js. Other benchmarks indicate that RPi v2 is significantly faster.
FriendlyARM NanoPi NEO Allwinner H3
Linux FriendlyARM 3.4.39-h3 #1 SMP PREEMPT Thu Aug 4 12:41:33 CST 2016 armv7l armv7l armv7l GNU/Linux
Ubuntu 15.10
Node v6.3.1
Score (version 9): 2111, duration 133.564 seconds
node version : v6.9.5
V8 version : 5.1.281.89
Openwrt BB & trunk
TI AM335x beagle bond
Score (version 9): 1313
Marvell armada 385
Score (version 9): 3559