Skip to content

Commit fb6dc11

Browse files
committed
Clean up some things in the benchmarks
1 parent 04999ef commit fb6dc11

3 files changed

Lines changed: 11 additions & 19 deletions

File tree

benchmark/process_loop.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
var path = require("path");
2-
libDir = path.join(path.dirname(__filename), "../lib");
3-
require.paths.unshift(libDir);
4-
var sys = (require("sys"));
5-
for (var i in sys) global[i] = sys[i];
1+
var sys = require("../lib/sys");
2+
63
function next (i) {
74
if (i <= 0) return;
85

96
var child = process.createChildProcess("echo", ["hello"]);
107

118
child.addListener("output", function (chunk) {
12-
if (chunk) print(chunk);
9+
if (chunk) sys.print(chunk);
1310
});
1411

1512
child.addListener("exit", function (code) {

benchmark/run.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
var path = require("path");
2-
libDir = path.join(path.dirname(__filename), "../lib");
3-
require.paths.unshift(libDir);
4-
var sys = (require("sys"));
5-
for (var i in sys) global[i] = sys[i];
2+
var sys = require("../lib/sys");
63
var benchmarks = [ "static_http_server.js"
74
, "timers.js"
85
, "process_loop.js"
96
];
107

11-
var benchmark_dir = path.dirname(__filename);
8+
var benchmarkDir = path.dirname(__filename);
129

1310
function exec (script, callback) {
1411
var start = new Date();
15-
var child = process.createChildProcess(process.ARGV[0], [path.join(benchmark_dir, script)]);
12+
var child = process.createChildProcess(process.ARGV[0], [path.join(benchmarkDir, script)]);
1613
child.addListener("exit", function (code) {
1714
var elapsed = new Date() - start;
1815
callback(elapsed, code);
@@ -21,12 +18,12 @@ function exec (script, callback) {
2118

2219
function runNext (i) {
2320
if (i >= benchmarks.length) return;
24-
print(benchmarks[i] + ": ");
21+
sys.print(benchmarks[i] + ": ");
2522
exec(benchmarks[i], function (elapsed, code) {
2623
if (code != 0) {
27-
puts("ERROR ");
24+
sys.puts("ERROR ");
2825
}
29-
puts(elapsed);
26+
sys.puts(elapsed);
3027
runNext(i+1);
3128
});
3229
};

benchmark/static_http_server.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
var path = require("path");
2-
libDir = path.join(path.dirname(__filename), "../lib");
3-
require.paths.unshift(libDir);
4-
http = require("http");
1+
var http = require("../lib/http");
2+
53
var concurrency = 30;
64
var port = 8000;
75
var n = 700;

0 commit comments

Comments
 (0)