Created
November 13, 2011 17:03
-
-
Save isaacs/1362338 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var start = Date.now() | |
http = require("http") | |
console.error("%d scheduling nextTick", Date.now() - start) | |
process.nextTick(function interval(){ | |
process.nextTick(interval) | |
process.stderr.write(".") | |
}) | |
console.error("%d nextTick created", Date.now() - start) | |
console.error("%d creating server", Date.now() - start) | |
http.createServer(function (req, res) { | |
console.error("\n%d SERVER: got request", Date.now() - start) | |
res.writeHead(200) | |
res.end("ok\n") | |
}).listen(1337) | |
console.error("%d server created", Date.now() - start) | |
console.error("%d scheduling request", Date.now() - start) | |
setTimeout(function () { | |
console.error("\n%d CLIENT: making request", Date.now() - start) | |
http.get({ host: "localhost" | |
, port: 1337 | |
, path: "/" }).on("response", function (res) { | |
console.error("\n%d CLIENT: got response", Date.now() - start) | |
res.pipe(process.stdout) | |
res.on("end", function () { | |
console.error("\n%d CLIENT: request ended", Date.now() - start) | |
process.exit(0) | |
}) | |
}) | |
}, 10) | |
console.error("%d first tick over", Date.now() - start) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: