Nodejs "Hello world" benchmark

新版本 nodejs 性能

本文将记录 nodejs 历史更新中所有版本的hello world性能测试。

测试环境

MacBook Pro 
13-inch, Mid 2010

Processor  2.4 GHz Intel Core 2 Duo
Memory  8 GB 1067 MHz DDR3
Software  OS X 10.8.2 (12C60)

测试 helloworld.js

var http = require('http');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, "127.0.0.1");

console.log('Server running at http://127.0.0.1:1337/');

siege 压测命令

$ siege -c 100 -b -t 10s http://127.0.0.1:1337/

测试结果: trans/sec (QPS)

v0.6.0与v0.4.12的性能对比

v0.6.0更新 说明文章中,列出的对比数据

v0.4.12 (linux) v0.6.0 (linux)

http_simple.js /bytes/1024  5461 r/s    6263 r/s
io.js read                  19.75 mB/s  26.63 mB/s
io.js write                 21.60 mB/s  17.40 mB/s
startup.js                  74.7 ms     49.6 ms

v0.4.12 (windows: Cygwin) v0.6.0 (windows)

http_simple.js /bytes/1024  3858 r/s    5823 r/s
io.js read                  12.41 mB/s  26.51 mB/s
io.js write                 12.61 mB/s  33.58 mB/s
startup.js                  152.81 ms   52.04 ms

v0.4 和 v0.6之间的更新说明请查看: API-changes-between-v0.4-and-v0.6

有爱

^_^ 希望本文对你有用

Comments

blog comments powered by Disqus
Fork me on GitHub