From 6d3b81fe500b9cd8ff9d739795c44f09b2f082d3 Mon Sep 17 00:00:00 2001 From: Slobodan Stojanovic Date: Wed, 28 Oct 2015 20:35:44 +0100 Subject: [PATCH] Update benchmark, remove --harmony flag and use arrow functions closes #567 Fix benchmark middleware - in promises body is on ctx not on this --- benchmarks/middleware.js | 10 ++-------- benchmarks/run | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/benchmarks/middleware.js b/benchmarks/middleware.js index d23755a..401d244 100644 --- a/benchmarks/middleware.js +++ b/benchmarks/middleware.js @@ -11,17 +11,11 @@ let n = parseInt(process.env.MW || '1', 10); console.log(` ${n} middleware`); while (n--) { - app.use(function(ctx, next){ - return next(); - }); + app.use((ctx, next) => next()); } const body = new Buffer('Hello World'); -app.use(function(ctx, next){ - return next().then(function(){ - this.body = body; - }); -}); +app.use((ctx, next) => next().then(() => ctx.body = body)); app.listen(3333); diff --git a/benchmarks/run b/benchmarks/run index f627ae9..93b5bc5 100755 --- a/benchmarks/run +++ b/benchmarks/run @@ -1,7 +1,7 @@ #!/usr/bin/env bash echo -MW=$1 node --harmony $2 & +MW=$1 node $2 & pid=$! sleep 2