News for hackers. Stuff that matters.
Re:GCC and C vs C++ Speed, Measured by willvarfar on Thursday March 21, 2013 @10:03AM (#5415057)
Interesting aside: There are some things that are faster in C++ than C, for example the standard library sort functions are massively faster because the compiler can in-line the comparison.
Re:GCC and C vs C++ Speed, Measured by aninteger on Thursday March 21, 2013 @10:27AM (#5415221)
Well, yes you are correct. However if you need the fastest sorting you're probably gonna inline the comparison regardless of language. If qsort is slow due to the function pointer comparison just move it inline manually.
Re:GCC and C vs C++ Speed, Measured by jedbrown on Thursday March 21, 2013 @10:39AM (#5415304)
The performance is the same if you put the qsort implementation in a header.

http://www.agottem.com/blog/inlining_qsort_sort

Re:GCC and C vs C++ Speed, Measured by malkia on Thursday March 21, 2013 @11:48AM (#5415887)
or use link-time compile generation (slow, and it might not work for huge projects like gcc/webkit, but if split into shared modules it can)