Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Upgrade benchmark scripts for new module API
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Oct 31, 2009
1 parent f230e45 commit d582599
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions benchmark/http_simple.js
@@ -1,8 +1,8 @@
libDir = process.path.join(process.path.dirname(__filename), "../lib"); libDir = process.path.join(process.path.dirname(__filename), "../lib");
require.paths.unshift(libDir); require.paths.unshift(libDir);


process.mixin(require("/utils.js")); process.mixin(require("sys"));
http = require("/http.js"); http = require("sys");


fixed = "" fixed = ""
for (var i = 0; i < 20*1024; i++) { for (var i = 0; i < 20*1024; i++) {
Expand Down
5 changes: 3 additions & 2 deletions benchmark/process_loop.js
@@ -1,6 +1,7 @@
libDir = process.path.join(process.path.dirname(__filename), "../lib"); var path = require("path");
libDir = path.join(path.dirname(__filename), "../lib");
require.paths.unshift(libDir); require.paths.unshift(libDir);
process.mixin(require("/utils.js")); process.mixin(require("sys"));
function next (i) { function next (i) {
if (i <= 0) return; if (i <= 0) return;


Expand Down
9 changes: 5 additions & 4 deletions benchmark/run.js
@@ -1,16 +1,17 @@
libDir = process.path.join(process.path.dirname(__filename), "../lib"); var path = require("path");
libDir = path.join(path.dirname(__filename), "../lib");
require.paths.unshift(libDir); require.paths.unshift(libDir);
process.mixin(require("/utils.js")); process.mixin(require("sys"));
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 = process.path.dirname(__filename); var benchmark_dir = 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], [process.path.join(benchmark_dir, script)]); var child = process.createChildProcess(process.ARGV[0], [path.join(benchmark_dir, 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);
Expand Down
5 changes: 3 additions & 2 deletions benchmark/static_http_server.js
@@ -1,6 +1,7 @@
libDir = process.path.join(process.path.dirname(__filename), "../lib"); var path = require("path");
libDir = path.join(path.dirname(__filename), "../lib");
require.paths.unshift(libDir); require.paths.unshift(libDir);
http = require("/http.js"); http = require("http");
var concurrency = 30; var concurrency = 30;
var port = 8000; var port = 8000;
var n = 700; var n = 700;
Expand Down

0 comments on commit d582599

Please sign in to comment.