Skip to content

Commit

Permalink
Migrates benchmarks to the new api.
Browse files Browse the repository at this point in the history
  • Loading branch information
arlolra authored and ry committed Mar 23, 2010
1 parent 54d4efd commit 6f84063
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
9 changes: 5 additions & 4 deletions benchmark/process_loop.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
9 changes: 5 additions & 4 deletions benchmark/run.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
6 changes: 3 additions & 3 deletions benchmark/static_http_server.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 6f84063

Please sign in to comment.