Le 22/04/2021 à 03:38, Yibo Cai a écrit :

Both using same libstdc++.
But std::bernoulli_distribution is inlined, so they are indeed different for 
clang and gcc.
https://godbolt.org/z/aT84x5Yec
Looks a pure compiler thing.

It looks like clang generates calls to logl() and __divtf3() (soft-float long double division) inside the loop. Perhaps that can be avoided by reimplementing the Bernoulli distribution. If we don't care too much about accuracy and extreme probability values (very close to 0 or 1), that should be relatively easy.

Regards

Antoine.

Reply via email to