Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support benchmark of async calls #3

Open
gitmalong opened this issue Jul 3, 2021 · 1 comment
Open

Support benchmark of async calls #3

gitmalong opened this issue Jul 3, 2021 · 1 comment

Comments

@gitmalong
Copy link


        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?

@EdgarACarneiro
Copy link
Contributor

EdgarACarneiro commented Jul 4, 2021

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 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants