Created
July 24, 2017 10:17
-
-
Save ngot/1c0f6019f3d2c3708322665f8df7b145 to your computer and use it in GitHub Desktop.
雪崩 Booom!
This file contains hidden or 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
const compose = require('koa-compose'); | |
const mids = []; | |
for (var i = 0; i < 20; i++) { | |
mids.push(async (context, next) => { | |
await next(); | |
}); | |
} | |
var fn = compose(mids); | |
var ctx = {}; | |
console.time('bench'); | |
for (var j = 0; j < 650000; j++) { | |
fn(ctx).then(() => {}).catch(e => console.log(e)); | |
} | |
console.timeEnd('bench'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
async-await 消耗内存很厉害哇