Update benchmark, remove --harmony flag and use arrow functions

closes #567

Fix benchmark middleware - in promises body is on ctx not on this
This commit is contained in:
Slobodan Stojanovic 2015-10-28 20:35:44 +01:00 committed by jongleberry
parent ae9edb6dc9
commit 6d3b81fe50
2 changed files with 3 additions and 9 deletions

View file

@ -11,17 +11,11 @@ let n = parseInt(process.env.MW || '1', 10);
console.log(` ${n} middleware`); console.log(` ${n} middleware`);
while (n--) { while (n--) {
app.use(function(ctx, next){ app.use((ctx, next) => next());
return next();
});
} }
const body = new Buffer('Hello World'); const body = new Buffer('Hello World');
app.use(function(ctx, next){ app.use((ctx, next) => next().then(() => ctx.body = body));
return next().then(function(){
this.body = body;
});
});
app.listen(3333); app.listen(3333);

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo echo
MW=$1 node --harmony $2 & MW=$1 node $2 &
pid=$! pid=$!
sleep 2 sleep 2