Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Is there any output for accurate milliseconds? #209

Open
ghost opened this issue Jul 31, 2018 · 1 comment
Open

Is there any output for accurate milliseconds? #209

ghost opened this issue Jul 31, 2018 · 1 comment
Labels

Comments

@ghost
Copy link

ghost commented Jul 31, 2018

Hi,
I know that benchmark will let me run several things together in async. It can check the times and who is the fastest and slowest.

But how can I output each time (in milliseconds or seconds... ect) for each function? I'd like to know the average time for each function takes? I didn't find anything in the API document..... Maybe you can guide me there?

Reguards!

@ghost
Copy link
Author

ghost commented Jul 31, 2018

PS:Until now I have to do something like this following, maybe not good:

 .on('complete', function () {

        let results = new Array();

        for (let prop in this) {
            if (!isNaN(prop)) {
                const eachResult = {
                    name: this[prop].name,
                    mean: this[prop].stats.mean,
                    moe: this[prop].stats.moe,
                    rme: this[prop].stats.rme,
                    sem: this[prop].stats.sem
                }
                results.push(eachResult);
            }
        }

        results = results.sort((a, b) => { return a.mean - b.mean });

        console.log(`Rand\tName\t\tTime (in seconds)`);
        let id = 1;

        for (let r of results) {
            console.log(`${id++}\t${r.name}\t\t${r.mean.toFixed(3)}`);
        }
    })

Is there anyway special or direct?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

1 participant