Hacker News new | past | comments | ask | show | jobs | submit login

As an LLVM developer, I really wish the author filed a bug report and waited for some analysis BEFORE publishing an article (that may never get amended) that recommends not using this keyword with clang for performance reasons. I suspect there's just a bug in clang.



Is there any logical reason why Clang is 50% slower than GCC on Ubuntu?


Hi, I had a look today because it was bugging me and no one had investigated it, so I created an issue[1] with an explanation.

But it basically boils down to uniform_real_distribution having a bunch of uninlined calls to 'logl' when compiled with Clang.

Otherwise, Clang beats GCC at least on the configuration I tested.

(I am the author of the issue)

[1] https://gitlab.com/define-private-public/PSRayTracing/-/issu...


Oh, very nice find!

Coincidentally, I happened to be playing around yesterday with a small performance test case using uniform_real_distribution, and for some strange reason Clang was 6x slower than GCC.

I put it down to some weird clang bug on my LTS version of Ubuntu. As my installed version was clang-14, I decided it possibly had been noticed and fixed a long time ago.

After reading your message I replaced uniform_real_distribution by uniform_int_distribution, and lo and behold, Clang was indeed faster than GCC, as expected.

Thank you for coming back to me with your findings.


Bug, misunderstanding, weird edge case…




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: