Skip to content

Commit

Permalink
more benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Apr 25, 2012
1 parent 85fc586 commit 25fe426
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions support/app.js
Expand Up @@ -23,4 +23,15 @@ app.get('/middleware', foo, foo, foo, foo, function(req, res){
res.send('Hello World\n');
});

var n = 100;
while (n--) {
app.get('/foo', function(req, res){

});
}

app.get('/match', function(req, res){
res.send('Hello World\n');
});

app.listen(8000);
6 changes: 5 additions & 1 deletion support/bench
Expand Up @@ -4,12 +4,16 @@ node ./support/app &
pid=$!

bench() {
ab -n 5000 -c 50 -k -q http://127.0.0.1:8000$1 | grep "Requests per" | cut -d ' ' -f 7 | xargs echo "$2:"
ab -n 5000 -c 50 -k -q http://127.0.0.1:8000$1 \
| grep "Requests per" \
| cut -d ' ' -f 7 \
| xargs echo "$2:"
}

sleep .5
bench / "Hello World"
bench /json "JSON"
bench /middleware "Middleware"
bench /match "Router"

kill -9 $pid

0 comments on commit 25fe426

Please sign in to comment.