I've built an application on Node.js and works instantly (in 300 ms) on Core i7 processor, Debian Scratch. When I try to run the same application on Raspberry, startup time is 7.2 seconds!.
While debugging, I understand that all waiting takes place on require
lines. It comes to this point:
$ touch test.js
$ time node test.js
real 0m0.930s
user 0m0.820s
sys 0m0.100s
The startup time is pretty much. Here is more timings:
// -------------------------- // startup time: 0.95 seconds
var _ = require('prelude-ls'); // adds 0.05 seconds
var io = require('socket.io'); // adds 2.20 seconds
var Hapi = require('hapi'); // adds 4.00 seconds
var zmq = require('zmq'); // adds 0.13 seconds
process.exit(1)
Is it because of these two libraries, or is there anything to do with Node.js on Raspberry?
Node.js version is v0.12.6
Edit
By the way, top
says Node.js consumes 103% of CPU power in these tests.
from aktos_dcs import *
) in python takes 190 ms on i7, 850 ms on Raspberry. Don't believe me, just do the math.