I use std::inner_product() to do the vector multiplication when performing matrix multiplication. This involves calling std::inner_product() within 2 nested loops (one across all rows, one across all columns). Unfortunately, g++-4.1.2 will not, it seems, inline the call even at -O5. If I provide my own version with an inline hint, it improves the speed of my matrix multiplication by ~15%, which is not to be sniffed at.
I suppose my questions would be: (a) erm, do you need proof? (b) should the compiler do the inlining regardless (ie, it's a compiler issue), or should the declaration of std::inner_product give a hint with the inline keyword (and perhaps also other functions)? Simon. -- Summary: inlining std::inner_product() Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: simon dot marshall at misys dot com GCC host triplet: sparc-sun-solaris2.8 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33293