Skip to content
Browse files

added set timeout benchmark

  • Loading branch information...
1 parent 7d3cfb1 commit ac0fef6bec88e32b53ba2ffe4e08a13a54bb822d @olegp committed
Showing with 31 additions and 0 deletions.
  1. +1 −0 README.md
  2. +10 −0 benchmarks/set-timeout/common-node.js
  3. +8 −0 benchmarks/set-timeout/node.js
  4. +12 −0 benchmarks/set-timeout/ringo.js
View
1 README.md
@@ -94,6 +94,7 @@ This will generate PNG images of the graphs in `benchmarks/results/graphs/`. Som
* [hello-world](http://olegp.github.com/common-node/graphs/hello-world.png) - returns a dynamically generated string
* [no-alloc](http://olegp.github.com/common-node/graphs/no-alloc.png)
* [parse-json](http://olegp.github.com/common-node/graphs/parse-json.png)
+ * [set-timeout](http://olegp.github.com/common-node/graphs/set-timeout.png) - sleep for 100ms before returning a response
* [static-file](http://olegp.github.com/common-node/graphs/static-file.png) - returns a file served from the file system
* [string-alloc](http://olegp.github.com/common-node/graphs/string-alloc.png)
View
10 benchmarks/set-timeout/common-node.js
@@ -0,0 +1,10 @@
+var sleep = require('system').sleep;
+
+exports.app = function() {
+ sleep(100);
+ return {
+ status : 200,
+ headers : {},
+ body : []
+ };
+}
View
8 benchmarks/set-timeout/node.js
@@ -0,0 +1,8 @@
+require('connect').createServer(function (req, res, next) {
+ setTimeout(function() {
+ res.writeHead(200, {});
+ res.end();
+ }, 100);
+}).listen(8080);
+
+
View
12 benchmarks/set-timeout/ringo.js
@@ -0,0 +1,12 @@
+exports.app = function() {
+ java.lang.Thread.sleep(100);
+ return {
+ status : 200,
+ headers : {},
+ body : []
+ };
+}
+
+if (require.main === module) {
+ require("ringo/httpserver").main(module.id);
+}

0 comments on commit ac0fef6

Please sign in to comment.
Something went wrong with that request. Please try again.