lefticus / cpp_weekly

The official C++ Weekly Repository. Code samples and notes of future / past episodes will land here at various times. PR's will be accepted in some cases.
The Unlicense
698 stars 26 forks source link

GCC vs Clang, which produces better code? #417

Open lefticus opened 1 month ago

lefticus commented 1 month ago

This is a follow-up to the #26 issues that were reported with clang producing code 1/2 the speed of gcc.

lefticus commented 1 month ago

Various versions being tested is here:

https://github.com/lefticus/cpp_weekly/tree/master/parallel_algorithms

Data: https://github.com/lefticus/cpp_weekly/blob/master/parallel_algorithms/performance_stats.csv

So far it looks like the fact that I used signed indexes for some of the code resulted in clang losing its mind, which, if you know anything about the history of the "used signed for performance" stuff, should be rather ironic.

I also need to run callgrind tests against the different versions and see what shakes out.

elbeno commented 1 month ago

Related: Alex Dathskovsky's (https://www.youtube.com/@cppnext-alexd) talk "To Int or to Uint?" at CppNorth 2024, to be repeated at CppCon 2024 https://cppcon2024.sched.com/event/1gZg0/to-int-or-to-uint-this-is-the-question