mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 07:00:59 +01:00
Clean up some things in the benchmarks
This commit is contained in:
parent
04999ef969
commit
fb6dc11f11
@ -1,15 +1,12 @@
|
|||||||
var path = require("path");
|
var sys = require("../lib/sys");
|
||||||
libDir = path.join(path.dirname(__filename), "../lib");
|
|
||||||
require.paths.unshift(libDir);
|
|
||||||
var sys = (require("sys"));
|
|
||||||
for (var i in sys) global[i] = sys[i];
|
|
||||||
function next (i) {
|
function next (i) {
|
||||||
if (i <= 0) return;
|
if (i <= 0) return;
|
||||||
|
|
||||||
var child = process.createChildProcess("echo", ["hello"]);
|
var child = process.createChildProcess("echo", ["hello"]);
|
||||||
|
|
||||||
child.addListener("output", function (chunk) {
|
child.addListener("output", function (chunk) {
|
||||||
if (chunk) print(chunk);
|
if (chunk) sys.print(chunk);
|
||||||
});
|
});
|
||||||
|
|
||||||
child.addListener("exit", function (code) {
|
child.addListener("exit", function (code) {
|
||||||
|
@ -1,18 +1,15 @@
|
|||||||
var path = require("path");
|
var path = require("path");
|
||||||
libDir = path.join(path.dirname(__filename), "../lib");
|
var sys = require("../lib/sys");
|
||||||
require.paths.unshift(libDir);
|
|
||||||
var sys = (require("sys"));
|
|
||||||
for (var i in sys) global[i] = sys[i];
|
|
||||||
var benchmarks = [ "static_http_server.js"
|
var benchmarks = [ "static_http_server.js"
|
||||||
, "timers.js"
|
, "timers.js"
|
||||||
, "process_loop.js"
|
, "process_loop.js"
|
||||||
];
|
];
|
||||||
|
|
||||||
var benchmark_dir = path.dirname(__filename);
|
var benchmarkDir = path.dirname(__filename);
|
||||||
|
|
||||||
function exec (script, callback) {
|
function exec (script, callback) {
|
||||||
var start = new Date();
|
var start = new Date();
|
||||||
var child = process.createChildProcess(process.ARGV[0], [path.join(benchmark_dir, script)]);
|
var child = process.createChildProcess(process.ARGV[0], [path.join(benchmarkDir, script)]);
|
||||||
child.addListener("exit", function (code) {
|
child.addListener("exit", function (code) {
|
||||||
var elapsed = new Date() - start;
|
var elapsed = new Date() - start;
|
||||||
callback(elapsed, code);
|
callback(elapsed, code);
|
||||||
@ -21,12 +18,12 @@ function exec (script, callback) {
|
|||||||
|
|
||||||
function runNext (i) {
|
function runNext (i) {
|
||||||
if (i >= benchmarks.length) return;
|
if (i >= benchmarks.length) return;
|
||||||
print(benchmarks[i] + ": ");
|
sys.print(benchmarks[i] + ": ");
|
||||||
exec(benchmarks[i], function (elapsed, code) {
|
exec(benchmarks[i], function (elapsed, code) {
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
puts("ERROR ");
|
sys.puts("ERROR ");
|
||||||
}
|
}
|
||||||
puts(elapsed);
|
sys.puts(elapsed);
|
||||||
runNext(i+1);
|
runNext(i+1);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
var path = require("path");
|
var http = require("../lib/http");
|
||||||
libDir = path.join(path.dirname(__filename), "../lib");
|
|
||||||
require.paths.unshift(libDir);
|
|
||||||
http = require("http");
|
|
||||||
var concurrency = 30;
|
var concurrency = 30;
|
||||||
var port = 8000;
|
var port = 8000;
|
||||||
var n = 700;
|
var n = 700;
|
||||||
|
Loading…
Reference in New Issue
Block a user