Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarlolra <arlolra@gmail.com>2010-03-23 04:47:04 +0300
committerRyan Dahl <ry@tinyclouds.org>2010-03-23 18:13:17 +0300
commit6f84063a3b06dae2dc919ee9ab371e4cddcd9112 (patch)
tree0d10f3551c08841f3e575f176d6e220152216cd1 /benchmark
parent54d4efd44b6a6d9ac4430012377a4c5064fec6c6 (diff)
Migrates benchmarks to the new api.
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/process_loop.js9
-rw-r--r--benchmark/run.js9
-rw-r--r--benchmark/static_http_server.js6
3 files changed, 13 insertions, 11 deletions
diff --git a/benchmark/process_loop.js b/benchmark/process_loop.js
index 55ad6c44958..18cc1695640 100644
--- a/benchmark/process_loop.js
+++ b/benchmark/process_loop.js
@@ -1,12 +1,13 @@
-var sys = require("../lib/sys");
+var sys = require("sys"),
+ childProcess = require("child_process");
function next (i) {
if (i <= 0) return;
- var child = process.createChildProcess("echo", ["hello"]);
+ var child = childProcess.spawn("echo", ["hello"]);
- child.addListener("output", function (chunk) {
- if (chunk) sys.print(chunk);
+ child.stdout.addListener("data", function (chunk) {
+ sys.print(chunk);
});
child.addListener("exit", function (code) {
diff --git a/benchmark/run.js b/benchmark/run.js
index b1ab79ecc1f..7917c768869 100644
--- a/benchmark/run.js
+++ b/benchmark/run.js
@@ -1,15 +1,16 @@
var path = require("path");
-var sys = require("../lib/sys");
-var benchmarks = [ "static_http_server.js"
- , "timers.js"
+var sys = require("sys");
+var childProcess = require("child_process");
+var benchmarks = [ "timers.js"
, "process_loop.js"
+ , "static_http_server.js"
];
var benchmarkDir = path.dirname(__filename);
function exec (script, callback) {
var start = new Date();
- var child = process.createChildProcess(process.ARGV[0], [path.join(benchmarkDir, script)]);
+ var child = childProcess.spawn(process.argv[0], [path.join(benchmarkDir, script)]);
child.addListener("exit", function (code) {
var elapsed = new Date() - start;
callback(elapsed, code);
diff --git a/benchmark/static_http_server.js b/benchmark/static_http_server.js
index 398b9bf204c..d5b0bf7c4de 100644
--- a/benchmark/static_http_server.js
+++ b/benchmark/static_http_server.js
@@ -1,8 +1,8 @@
-var http = require("../lib/http");
+var http = require("http");
var concurrency = 30;
-var port = 8000;
-var n = 700;
+var port = 12346;
+var n = 7; // several orders of magnitude slower
var bytes = 1024*5;
var requests = 0;