most-inesctec / kruonis

:hourglass: A tool to perform benchmarks, on TypeScript :hourglass:

Home Page:https://www.npmjs.com/package/kruonis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support benchmark of async calls

gitmalong opened this issue · comments


        benchmark
            .add(
                new Test('Sleep', async() => {
                    await sleep(10000)
                }))


        const results: Array<[string, Stats]> = await benchmark.run();
        for (let result of results) {
            console.log("Test name: " + result[0])
            console.log("Test stats: ")
            console.log(result[1])
        }

This code prints the results before the sleep promise was resolved. How to use benchmark with async calls?

Indeed, the code is currently not supporting async functions.

I didn't see many benefits at the time, as the goal is to measure the active time that a given function takes.

Feel free to propose a solution where you adapt kruonis to support that 😃