Skip to content

Demo of constexpr/nonconstexpr bench#27

Open
fredroy wants to merge 5 commits intoalxbilger:mainfrom
fredroy:demo_constexpr_mat
Open

Demo of constexpr/nonconstexpr bench#27
fredroy wants to merge 5 commits intoalxbilger:mainfrom
fredroy:demo_constexpr_mat

Conversation

@fredroy
Copy link
Collaborator

@fredroy fredroy commented Sep 8, 2022

Obviously, if the constexpr function compiles, then the result is instantaneous

BM_Matrix_typemat3x3f_noconstexpr_bench/512      0.443 us        0.445 us      1544828
BM_Matrix_typemat3x3f_constexpr_bench/512        0.002 us        0.002 us    373333333

+ add a constexpr random generator (from https://www.youtube.com/watch?v=rpn_5Mrrxf8 😎 of course)

This branch needs SOFA's Mat.h to be fixed, as std::abs is not constexpr (officially)

Copy link
Owner

@alxbilger alxbilger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make the seed fixed so that benchmarks are reproducible from a compilation to another?

@alxbilger
Copy link
Owner

@fredroy there is a conflict to solve.

Also, could you check that the random numbers are always the same?

@fredroy
Copy link
Collaborator Author

fredroy commented Sep 13, 2022

@fredroy there is a conflict to solve.

Also, could you check that the random numbers are always the same?

same between what?
in any case it wont be the same between each compilation as the seed is based on TIME (which I suppose is the time at the moment of the compilation)

@alxbilger
Copy link
Owner

That's what I mean. If you compile twice the benchmark you won't have the same numbers, so the benchmarks are not rigorously reproducible. If the seed is, let's say, 12, the numbers will stay the same between two compilations

@fredroy
Copy link
Collaborator Author

fredroy commented Sep 13, 2022

That's what I mean. If you compile twice the benchmark you won't have the same numbers, so the benchmarks are not rigorously reproducible. If the seed is, let's say, 12, the numbers will stay the same between two compilations

I see, so we should add a fixed seed or something like that

@alxbilger
Copy link
Owner

Yes, we should be able to provide a seed to the random numbers generator. And in the benchmarks, use a constant seed.

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

Successfully merging this pull request may close these issues.

2 participants