Created
March 23, 2010 01:48
-
-
Save arlolra/340767 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 54592cf1c231ade58339a70b6bc37dd58f0fed5f Mon Sep 17 00:00:00 2001 | |
From: arlolra <[email protected]> | |
Date: Mon, 22 Mar 2010 21:47:04 -0400 | |
Subject: [PATCH] Migrates benchmarks to the new api. | |
--- | |
benchmark/process_loop.js | 7 ++++--- | |
benchmark/run.js | 7 ++++--- | |
benchmark/static_http_server.js | 4 ++-- | |
3 files changed, 10 insertions(+), 8 deletions(-) | |
diff --git a/benchmark/process_loop.js b/benchmark/process_loop.js | |
index 55ad6c4..587c38a 100644 | |
--- a/benchmark/process_loop.js | |
+++ b/benchmark/process_loop.js | |
@@ -1,11 +1,12 @@ | |
-var sys = require("../lib/sys"); | |
+var sys = require("../lib/sys"), | |
+ child_process = require("child_process"); | |
function next (i) { | |
if (i <= 0) return; | |
- var child = process.createChildProcess("echo", ["hello"]); | |
+ var child = child_process.spawn("echo", ["hello"]); | |
- child.addListener("output", function (chunk) { | |
+ child.stdout.addListener("data", function (chunk) { | |
if (chunk) sys.print(chunk); | |
}); | |
diff --git a/benchmark/run.js b/benchmark/run.js | |
index b1ab79e..602f887 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 child_process = 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 = child_process.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 398b9bf..ee4adb3 100644 | |
--- a/benchmark/static_http_server.js | |
+++ b/benchmark/static_http_server.js | |
@@ -1,8 +1,8 @@ | |
var http = require("../lib/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; | |
-- | |
1.6.6.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment