https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92559

--- Comment #4 from Konstantin Kharlamov <Hi-Angel at yandex dot ru> ---
By the way, FTR: I don't have the code anymore, but initially the problem came
from a real-life algorithm involving lots of state, which looked barely
readable when implemented in iterative way (i.e. as opposed to "recursive",
that is when you use for/while-cycles instead of recursion). The iterative
version was 1.5 times bigger than the recursive one, and has a lot of
additional state-tracking variables; and I think it also has two cycles (as
compared to recursive version that has none at all).

Back then we decided that we want the readable code, because at the end of the
day, readable code is the reason people don't write assembly and rely on
compilers to optimize instead. Of course, we would have to add to CI some
checks to make sure the optimization was done as expected (tho I don't think it
was ever added, simply because since the optimization currently doesn't work,
there's nothing to check).

IIRC, this bug-report was a reduced problem of tail-recursion not working for
us. The state in the algorithm has std::map in particular I think.

Reply via email to