On Wed, Feb 12, 2025 at 05:44:40PM +0100, Basile Starynkevitch wrote: > b) one 307725-line-long function [4] takes 2 hours on `clang -Oz` and > 10 minutes on `clang -O0` > > But such a huge function cannot be written by a human being: it is not > understandable and not readable. You underestimate human beings. It may be foolish and take ridiculous effort to do foolish things like this, but many people actually manage. Of course in the end it does not help them, they just get bigger problems then, but people still do. (And sometimes it *does* make sense, btw. I have written functions >10k lines by hand before. 300k is more, sure, but not that much more. Breaking up functions where that only hinders legibility is not a good plan. Of course most of the time things can be easily restructured to be better readable. And remember: the primary consumer of any program is the human reader!) > My summary: dont expect the GCC (or Clang) compiler to compile "well" (e.g. > quickly and with effective optimization) a generated C or C++ (or Fortran) > function with a hundred thousand statements. "Well" means within a factor of three of best achievable. Both for hand-written and for generated code. You can hope the compiler manages this, and most people will tell you that it usually does! Segher