The attached shell script will generate a larger version of the following:
constexpr bool static_str_equal(const char* x, const char* y) { return (*x == 0 || *y == 0) ? (*x == *y) : ((*x == *y) && static_str_equal(x + 1, y + 1)); } int main(void) { static_assert( !static_str_equal("unspecified1", "unspecified"), ""); } There is a significant slow down and increase in ram usage compiling that, between gcc 4.9.3 and 5.3.1 (20151207): $ sh cstrcmp.sh > cstrcmp.cpp $ ~/gcc-4.9.3/g++ -ftime-report --std=gnu++11 cstrcmp.cpp Execution times (seconds) phase setup : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 1%) wall 1445 kB ( 1%) ggc phase parsing : 0.91 (100%) usr 0.16 (100%) sys 1.08 (99%) wall 149089 kB (99%) ggc |name lookup : 0.03 ( 3%) usr 0.00 ( 0%) sys 0.02 ( 2%) wall 89 kB ( 0%) ggc |overload resolution : 0.01 ( 1%) usr 0.00 ( 0%) sys 0.02 ( 2%) wall 628 kB ( 0%) ggc preprocessing : 0.02 ( 2%) usr 0.05 (31%) sys 0.04 ( 4%) wall 2048 kB ( 1%) ggc parser (global) : 0.02 ( 2%) usr 0.03 (19%) sys 0.08 ( 7%) wall 16178 kB (11%) ggc parser function body : 0.87 (96%) usr 0.08 (50%) sys 0.96 (88%) wall 130855 kB (87%) ggc TOTAL : 0.91 0.16 1.09 150594 kB $ g++ -ftime-report --std=gnu++11 cstrcmp.cpp # default fedora version Execution times (seconds) phase setup : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall 1408 kB ( 0%) ggc phase parsing : 1.90 (99%) usr 0.26 (100%) sys 2.16 (100%) wall 469089 kB (100%) ggc phase opt and generate : 0.01 ( 1%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 53 kB ( 0%) ggc |name lookup : 0.04 ( 2%) usr 0.00 ( 0%) sys 0.05 ( 2%) wall 93 kB ( 0%) ggc |overload resolution : 0.01 ( 1%) usr 0.00 ( 0%) sys 0.00 ( 0%) wall 628 kB ( 0%) ggc garbage collection : 0.20 (10%) usr 0.02 ( 8%) sys 0.21 (10%) wall 0 kB ( 0%) ggc preprocessing : 0.01 ( 1%) usr 0.05 (19%) sys 0.08 ( 4%) wall 2048 kB ( 0%) ggc parser (global) : 0.02 ( 1%) usr 0.04 (15%) sys 0.05 ( 2%) wall 16181 kB ( 3%) ggc parser function body : 1.67 (87%) usr 0.15 (58%) sys 1.82 (84%) wall 450852 kB (96%) ggc integrated RA : 0.01 ( 1%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 24 kB ( 0%) ggc TOTAL : 1.91 0.26 2.17 470569 kB Note I compiled the gcc 5 branch at 20160302 with the same results. thanks, Pádraig
cstrcmp.sh
Description: Bourne shell script