Created
July 24, 2017 10:17
雪崩 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 消耗内存很厉害哇