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

nanobench documentation suggestion #123

Open
melg8 opened this issue Dec 14, 2024 · 0 comments
Open

nanobench documentation suggestion #123

melg8 opened this issue Dec 14, 2024 · 0 comments

Comments

@melg8
Copy link

melg8 commented Dec 14, 2024

When running minimal example from readme:

#define ANKERL_NANOBENCH_IMPLEMENT
#include <nanobench.h>

int main() {
    double d = 1.0;
    ankerl::nanobench::Bench().run("some double ops", [&] {
        d += 1.0 / d;
        if (d > 5.0) {
            d -= 5.0;
        }
        ankerl::nanobench::doNotOptimizeAway(d);
    });
}

You get ouput like so:

ns/op op/s err% total benchmark
7.92 126,322,335.20 2.5% 0.01 some double ops

Which has less information than were shown in documenation for same example:

ns/op op/s err% ins/op cyc/op IPC bra/op miss% total benchmark
7.52 132,948,239.79 1.1% 6.65 24.07 0.276 1.00 8.9% 0.00 some double ops

Reproducible: https://godbolt.org/z/o7nEEP3P9

Only after reading this #99 i found out about need of usage linux + perf tool to get same extended output.

I would suggest to have "default" behavior represented in readme/docs first and only then - extended version with explanation of environment/tools needed for it to work. Cause now, at least few people got confused why "hello world" example on windows, in linux docker container (which doesnt have perf by default) and even godbolt - are all showing other output than presented in readme as if it was default output.

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

1 participant