Skip to content

Instantly share code, notes, and snippets.

@stephenmathieson
Last active January 1, 2016 03:29
Show Gist options
  • Save stephenmathieson/8085511 to your computer and use it in GitHub Desktop.
Save stephenmathieson/8085511 to your computer and use it in GitHub Desktop.
extremely primitive node version benchmarks
var http = require('http');
http
.createServer(function (req, res) {
// some trivial computation
var message = 'Hello world!';
res.writeHead(200, {
'content-type': 'text/plain'
});
for (var i = 0, data; data = message[i]; i++) {
res.write(data);
}
res.end(0);
})
.listen(1337, function () {
console.log('Node %s listening on %d', process.version, 1337);
});
#!/bin/bash
benchmark() {
nvm use $1 > /dev/null
echo
node app &
pid=$!
sleep 1
wrk -c 100 -t 10 http://localhost:1337
kill $pid
}
versions="0.8 0.9 0.10 0.11"
source ~/.nvm/nvm.sh
for version in $versions; do
nvm install $version > /dev/null
done
for version in $versions; do
benchmark $version
done

results on my mbp:

$ ./bench

Node v0.8.27 listening on 1337
Running 10s test @ http://localhost:1337
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    16.13ms    0.95ms  26.28ms   94.17%
    Req/Sec   627.14     98.70   794.00     49.70%
  61622 requests in 10.00s, 12.40MB read
Requests/sec:   6160.98
Transfer/sec:      1.24MB

Node v0.9.12 listening on 1337
Running 10s test @ http://localhost:1337
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    15.27ms  741.39us  22.62ms   95.28%
    Req/Sec   663.27     70.69   769.00     68.89%
  65036 requests in 10.00s, 13.09MB read
Requests/sec:   6502.82
Transfer/sec:      1.31MB

Node v0.10.29 listening on 1337
Running 10s test @ http://localhost:1337
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    26.80ms    0.96ms  35.74ms   90.69%
    Req/Sec   375.86     59.37   491.00     68.38%
  37134 requests in 10.00s, 7.47MB read
Requests/sec:   3712.10
Transfer/sec:    764.90KB

Node v0.11.13 listening on 1337
Running 10s test @ http://localhost:1337
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    21.07ms    1.61ms  34.08ms   89.02%
    Req/Sec   479.41     43.57   615.00     79.81%
  47190 requests in 10.00s, 9.50MB read
Requests/sec:   4718.39
Transfer/sec:      0.95MB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment