From d582599c14ba2adcc1a8f94dcd9c583564e618a7 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sat, 31 Oct 2009 20:06:46 +0100 Subject: [PATCH] Upgrade benchmark scripts for new module API --- benchmark/http_simple.js | 4 ++-- benchmark/process_loop.js | 5 +++-- benchmark/run.js | 9 +++++---- benchmark/static_http_server.js | 5 +++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js index ab4955bafa..7fec434724 100644 --- a/benchmark/http_simple.js +++ b/benchmark/http_simple.js @@ -1,8 +1,8 @@ libDir = process.path.join(process.path.dirname(__filename), "../lib"); require.paths.unshift(libDir); -process.mixin(require("/utils.js")); -http = require("/http.js"); +process.mixin(require("sys")); +http = require("sys"); fixed = "" for (var i = 0; i < 20*1024; i++) { diff --git a/benchmark/process_loop.js b/benchmark/process_loop.js index 962ad93a78..372a89cf34 100644 --- a/benchmark/process_loop.js +++ b/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); -process.mixin(require("/utils.js")); +process.mixin(require("sys")); function next (i) { if (i <= 0) return; diff --git a/benchmark/run.js b/benchmark/run.js index 820c4e3580..8466b9760f 100644 --- a/benchmark/run.js +++ b/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); -process.mixin(require("/utils.js")); +process.mixin(require("sys")); var benchmarks = [ "static_http_server.js" , "timers.js" , "process_loop.js" ]; -var benchmark_dir = process.path.dirname(__filename); +var benchmark_dir = path.dirname(__filename); function exec (script, callback) { 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) { var elapsed = new Date() - start; callback(elapsed, code); diff --git a/benchmark/static_http_server.js b/benchmark/static_http_server.js index 47e92689c1..6d925b514e 100644 --- a/benchmark/static_http_server.js +++ b/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); -http = require("/http.js"); +http = require("http"); var concurrency = 30; var port = 8000; var n = 700;