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

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge commit 'v0.6.21' into openshift
  • Loading branch information
piscisaureus committed Aug 14, 2012
2 parents 00cbcfc + 55ddf54 commit 5be1814
Show file tree
Hide file tree
Showing 459 changed files with 9,090 additions and 4,321 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -40,4 +40,3 @@ ipch/
email.md
blog.html
deps/v8-*
node_modules
24 changes: 23 additions & 1 deletion ChangeLog
@@ -1,4 +1,26 @@
2012.06.06 Version 0.6.19 (stable)
2012.08.03 Version 0.6.21 (maintenance)

* sunos: work around OS bug to prevent fs.watch() from spinning (Bryan Cantrill)

* net: make pause/resume work with connecting sockets (Bert Belder)


2012.07.10 Version 0.6.20 (maintenance), 952e513379169ec1b40909d1db056e9bf4294899

* npm: Upgrade to 1.1.37 (isaacs)

* benchmark: Backport improvements made in master (isaacs)

* build: always link with -lz (Trent Mick)

* core: use proper #include directives (Ben Noordhuis)

* cluster: don't silently drop messages when the write queue gets big (Bert Belder)

* windows: don't print error when GetConsoleTitleW returns an empty string (Bert Belder)


2012.06.06 Version 0.6.19 (stable), debf552ed2d4a53957446e82ff3c52a8182d5ff4

* npm: upgrade to 1.1.24

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -209,9 +209,9 @@ $(PKG):

$(TARBALL): out/doc
git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
mkdir -p $(TARNAME)/doc
mkdir -p $(TARNAME)/doc/api
cp doc/node.1 $(TARNAME)/doc/node.1
cp -r out/doc/api $(TARNAME)/doc/api
cp -r out/doc/api/* $(TARNAME)/doc/api/
rm -rf $(TARNAME)/deps/v8/test # too big
rm -rf $(TARNAME)/doc/images # too big
tar -cf $(TARNAME).tar $(TARNAME)
Expand Down
72 changes: 72 additions & 0 deletions benchmark/fs-readfile.js
@@ -0,0 +1,72 @@
// Call fs.readFile over and over again really fast.
// Then see how many times it got called.
// Yes, this is a silly benchmark. Most benchmarks are silly.

var path = require('path');
var filename = path.resolve(__dirname, 'http.sh');
var fs = require('fs');
var count = 0;
var go = true;
var len = -1;
var assert = require('assert');

var concurrency = 1;
var encoding = null;
var time = 10;

for (var i = 2; i < process.argv.length; i++) {
var arg = process.argv[i];
if (arg.match(/^-e$/)) {
encoding = process.argv[++i] || null;
} else if (arg.match(/^-c$/)) {
concurrency = ~~process.argv[++i];
if (concurrency < 1) concurrency = 1;
} else if (arg === '-t') {
time = ~~process.argv[++i];
if (time < 1) time = 1;
}
}


setTimeout(function() {
go = false;
}, time * 1000);

function round(n) {
return Math.floor(n * 100) / 100;
}

var start = Date.now();
while (concurrency--) readFile();

function readFile() {
if (!go) {
process.stdout.write('\n');
console.log('read the file %d times (higher is better)', count);
var end = Date.now();
var elapsed = (end - start) / 1000;
var ns = elapsed * 1E9;
var nsper = round(ns / count);
console.log('%d ns per read (lower is better)', nsper);
var readsper = round(count / (ns / 1E9));
console.log('%d reads per sec (higher is better)', readsper);
process.exit(0);
return;
}

if (!(count % 1000)) {
process.stdout.write('.');
}

if (encoding) fs.readFile(filename, encoding, then);
else fs.readFile(filename, then);

function then(er, data) {
assert.ifError(er);
count++;
// basic sanity test: we should get the same number of bytes each time.
if (count === 1) len = data.length;
else assert(len === data.length);
readFile();
}
}
12 changes: 12 additions & 0 deletions benchmark/http.sh
@@ -0,0 +1,12 @@
#!/bin/bash
cd "$(dirname "$(dirname $0)")"
sudo sysctl -w net.inet.ip.portrange.first=12000
sudo sysctl -w net.inet.tcp.msl=1000
sudo sysctl -w kern.maxfiles=1000000 kern.maxfilesperproc=1000000
ulimit -n 100000

./node benchmark/http_simple.js || exit 1 &
sleep 1

ab -n 30000 -c 100 http://127.0.0.1:8000/${TYPE:-bytes}/${LENGTH:-1024} | grep Req
killall node
109 changes: 70 additions & 39 deletions benchmark/http_simple.js
@@ -1,75 +1,99 @@
path = require("path");
exec = require("child_process").exec;
http = require("http");
var path = require('path'),
exec = require('child_process').exec,
http = require('http');

port = parseInt(process.env.PORT || 8000);
var port = parseInt(process.env.PORT || 8000);

console.log('pid ' + process.pid);

fixed = ""
for (var i = 0; i < 20*1024; i++) {
fixed += "C";
var fixed = makeString(20 * 1024, 'C'),
storedBytes = {},
storedBuffer = {},
storedUnicode = {};

var useDomains = process.env.NODE_USE_DOMAINS;

// set up one global domain.
if (useDomains) {
var domain = require('domain');
var gdom = domain.create();
gdom.on('error', function(er) {
console.log('Error on global domain', er);
throw er;
});
gdom.enter();
}

stored = {};
storedBuffer = {};

var server = http.createServer(function (req, res) {
var commands = req.url.split("/");
if (useDomains) {
var dom = domain.create();
dom.add(req);
dom.add(res);
}

var commands = req.url.split('/');
var command = commands[1];
var body = "";
var body = '';
var arg = commands[2];
var n_chunks = parseInt(commands[3], 10);
var status = 200;

if (command == "bytes") {
var n = parseInt(arg, 10)
if (command == 'bytes') {
var n = ~~arg;
if (n <= 0)
throw "bytes called with n <= 0"
if (stored[n] === undefined) {
console.log("create stored[n]");
stored[n] = "";
for (var i = 0; i < n; i++) {
stored[n] += "C"
}
throw new Error('bytes called with n <= 0')
if (storedBytes[n] === undefined) {
console.log('create storedBytes[n]');
storedBytes[n] = makeString(n, 'C');
}
body = stored[n];
body = storedBytes[n];

} else if (command == "buffer") {
var n = parseInt(arg, 10)
if (n <= 0) throw new Error("bytes called with n <= 0");
} else if (command == 'buffer') {
var n = ~~arg;
if (n <= 0)
throw new Error('buffer called with n <= 0');
if (storedBuffer[n] === undefined) {
console.log("create storedBuffer[n]");
console.log('create storedBuffer[n]');
storedBuffer[n] = new Buffer(n);
for (var i = 0; i < n; i++) {
storedBuffer[n][i] = "C".charCodeAt(0);
storedBuffer[n][i] = 'C'.charCodeAt(0);
}
}
body = storedBuffer[n];

} else if (command == "quit") {
} else if (command == 'unicode') {
var n = ~~arg;
if (n <= 0)
throw new Error('unicode called with n <= 0');
if (storedUnicode[n] === undefined) {
console.log('create storedUnicode[n]');
storedUnicode[n] = makeString(n, '\u263A');
}
body = storedUnicode[n];

} else if (command == 'quit') {
res.connection.server.close();
body = "quitting";
body = 'quitting';

} else if (command == "fixed") {
} else if (command == 'fixed') {
body = fixed;

} else if (command == "echo") {
res.writeHead(200, { "Content-Type": "text/plain",
"Transfer-Encoding": "chunked" });
} else if (command == 'echo') {
res.writeHead(200, { 'Content-Type': 'text/plain',
'Transfer-Encoding': 'chunked' });
req.pipe(res);
return;

} else {
status = 404;
body = "not found\n";
body = 'not found\n';
}

// example: http://localhost:port/bytes/512/4
// sends a 512 byte body in 4 chunks of 128 bytes
if (n_chunks > 0) {
res.writeHead(status, { "Content-Type": "text/plain",
"Transfer-Encoding": "chunked" });
res.writeHead(status, { 'Content-Type': 'text/plain',
'Transfer-Encoding': 'chunked' });
// send body in chunks
var len = body.length;
var step = ~~(len / n_chunks) || len;
Expand All @@ -82,13 +106,20 @@ var server = http.createServer(function (req, res) {
} else {
var content_length = body.length.toString();

res.writeHead(status, { "Content-Type": "text/plain",
"Content-Length": content_length });
res.writeHead(status, { 'Content-Type': 'text/plain',
'Content-Length': content_length });
res.end(body);
}

});

function makeString(size, c) {
var s = '';
while (s.length < size) {
s += c;
}
return s;
}

server.listen(port, function () {
console.log('Listening at http://127.0.0.1:'+port+'/');
});
Expand Down
4 changes: 2 additions & 2 deletions benchmark/io.js
Expand Up @@ -62,7 +62,7 @@ function readtest(size, bsize) {

function wt(tsize, bsize, done) {
var start = Date.now();
s = writetest(tsize, bsizes[0]);
s = writetest(tsize, bsize);
s.addListener('close', function() {
var end = Date.now();
var diff = end - start;
Expand All @@ -73,7 +73,7 @@ function wt(tsize, bsize, done) {

function rt(tsize, bsize, done) {
var start = Date.now();
s = readtest(tsize, bsizes[0]);
s = readtest(tsize, bsize);
s.addListener('close', function() {
var end = Date.now();
var diff = end - start;
Expand Down
22 changes: 11 additions & 11 deletions deps/npm/.npmignore
@@ -1,16 +1,16 @@
*.swp
test/bin
test/output.log
test/packages/*/node_modules
test/packages/npm-test-depends-on-spark/which-spark.log
test/packages/test-package/random-data.txt
test/root
node_modules/ronn
node_modules/.bin
npm-debug.log
./npmrc
.gitignore
release/
/test/bin
/test/output.log
/test/packages/*/node_modules
/test/packages/npm-test-depends-on-spark/which-spark.log
/test/packages/test-package/random-data.txt
/test/root
/node_modules/ronn
/node_modules/tap
/node_modules/.bin
/npmrc
/release/

# don't need these in the npm package.
html/*.png
Expand Down
5 changes: 5 additions & 0 deletions deps/npm/AUTHORS
Expand Up @@ -66,3 +66,8 @@ Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
Dalmais Maxence <github@maxired.fr>
Marcus Ekwall <marcus.ekwall@gmail.com>
Aaron Stacy <aaron.r.stacy@gmail.com>
Phillip Howell <phowell@cothm.org>
Domenic Denicola <domenic@domenicdenicola.com>
James Halliday <mail@substack.net>
Jeremy Cantrell <jmcantrell@gmail.com>
Ribettes <patlogan29@gmail.com>
5 changes: 5 additions & 0 deletions deps/npm/LICENSE
Expand Up @@ -49,6 +49,11 @@ and are not covered by this license.
"npm Logo" created by Mathias Pettersson and Brian Hammond,
used with permission.

"Gubblebum Blocky" font
Copyright (c) 2007 by Tjarda Koster, http://jelloween.deviantart.com
included for use in the npm website and documentation,
used with permission.

This program uses "node-uuid", Copyright (c) 2010 Robert Kieffer,
according to the terms of the MIT license.

Expand Down
6 changes: 0 additions & 6 deletions deps/npm/README.md
Expand Up @@ -89,21 +89,15 @@ To install the latest **unstable** development version from git:

git clone https://github.com/isaacs/npm.git
cd npm
git submodule update --init --recursive
sudo make install # (or: `node cli.js install -gf`)

If you're sitting in the code folder reading this document in your
terminal, then you've already got the code. Just do:

git submodule update --init --recursive
sudo make install

and npm will install itself.

Note that github tarballs **do not contain submodules**, so
those won't work. You'll have to also fetch the appropriate submodules
listed in the .gitmodules file.

## Permissions when Using npm to Install Other Stuff

**tl;dr**
Expand Down
13 changes: 10 additions & 3 deletions deps/npm/bin/npm
@@ -1,6 +1,13 @@
#!/bin/sh
if [ -x "`dirname "$0"`/node.exe" ]; then
"`dirname "$0"`/node.exe" "`dirname "$0"`/node_modules/npm/bin/npm-cli.js" "$@"

basedir=`dirname "$0"`

case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

if [ -x "$basedir/node.exe" ]; then
"$basedir/node.exe" "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
else
node "`dirname "$0"`/node_modules/npm/bin/npm-cli.js" "$@"
node "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
fi

0 comments on commit 5be1814

Please sign in to comment.