3 ms·
I did some investigation into the performance impacts of using the _Generic keyword in C11. It was a toy example so not necessarily broadly applicable to real w
by AndrewBissell 6y ago
I did some investigation into the performance impacts of using the _Generic keyword in C11. It was a toy example so not necessarily broadly applicable to real world code, but a good 70 or 80 percent of the speedup from generics seemed to come from inlining.
https://abissell.com/2014/01/16/c11s-_generic-keyword-macro-applications-and-performance-impacts/ https://abissell.com/2014/01/16/c11s-_generic-keyword-macro-...
- twoodfin 6y agoInlining is also what’s behind the classic “C++ is faster than C” example of “sort()”.
- vlovich123 6y agoI think an area ripe for improvement is compilers to think about which monomorphized variant is valuable & can benefit from that inlining vs where the dynamic dispatch is sufficient. Start with PGO & I'm sure smarter people will investigate how that can be done for 80% of the benfit at compile time without PGO.