when is it best to use a recursive function vs a for loop

jackpot@lemmy.mlbanned from sitebanned from site to Programming@programming.dev – 30 points –
50

You are viewing a single comment

Yeah but performance has way more to do with architecture than it does code readability. It doesn't matter how well you write your code, if it's an electron app it's going to use more ram than a native app. So I totally agree, but at the scale that it's a real problem it has more to do with architecture than the code in any given function.

Yeah but performance has way more to do with architecture than it does code readability.

Indeed, I am a bit notorious at work for speeding C++ code up by rewriting it in Python, and I have been able to do this not because my Python code is particularly fast but because the architecture of the C++ code was such a complicated and inefficient mess that it actually managed to be slower than Python.

That just hurts me. I love to bag on Python for being slow. But that also totally makes sense.