summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2009-10-05 15:46:31 +0200
committerRyan Dahl <ry@tinyclouds.org>2009-10-05 15:46:31 +0200
commit8185e1fd2501d2d5001d254213c41002440ec7fc (patch)
tree0f899b26354464329572be87f33d0677a45007b7 /benchmark
parent522909bcbf6ff577ddf66b8c07148cf581615157 (diff)
downloadnode-new-8185e1fd2501d2d5001d254213c41002440ec7fc.tar.gz
Remove include() add node.mixin()
include() should not be used by libraries because it will pollute the global namespace. To discourage this behavior and bring Node more in-line with the current CommonJS module system, include() is removed. Small scripts like unit tests often times do want to pollute the global namespace for ease. To avoid the boiler plate code of var x = require("/x.js"); var foo = x.foo; var bar = x.bar; The function node.mixin() is stolen from jQuery's jQuery.extend. So that it can be written: node.mixin(require("/x.js")); Reference: http://docs.jquery.com/Utilities/jQuery.extend http://groups.google.com/group/nodejs/browse_thread/thread/f9ac83e5c11e7e87
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/http_simple.js4
-rw-r--r--benchmark/process_loop.js2
-rw-r--r--benchmark/run.js2
3 files changed, 4 insertions, 4 deletions
diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js
index f334c01fd5..8974af647c 100644
--- a/benchmark/http_simple.js
+++ b/benchmark/http_simple.js
@@ -1,7 +1,7 @@
libDir = node.path.join(node.path.dirname(__filename), "../lib");
node.libraryPaths.unshift(libDir);
-include("/utils.js");
+node.mixin(require("/utils.js"));
http = require("/http.js");
fixed = ""
@@ -16,7 +16,7 @@ http.createServer(function (req, res) {
var arg = commands[2];
var status = 200;
- //p(req.headers);
+ p(req.uri.params);
if (command == "bytes") {
var n = parseInt(arg, 10)
diff --git a/benchmark/process_loop.js b/benchmark/process_loop.js
index 2e1e35465a..e338ad3806 100644
--- a/benchmark/process_loop.js
+++ b/benchmark/process_loop.js
@@ -1,6 +1,6 @@
libDir = node.path.join(node.path.dirname(__filename), "../lib");
node.libraryPaths.unshift(libDir);
-include("/utils.js");
+node.mixin(require("/utils.js"));
function next (i) {
if (i <= 0) return;
diff --git a/benchmark/run.js b/benchmark/run.js
index d9c2668687..869ae55a63 100644
--- a/benchmark/run.js
+++ b/benchmark/run.js
@@ -1,6 +1,6 @@
libDir = node.path.join(node.path.dirname(__filename), "../lib");
node.libraryPaths.unshift(libDir);
-include("/utils.js");
+node.mixin(require("/utils.js"));
var benchmarks = [ "static_http_server.js"
, "timers.js"
, "process_loop.js"