When talking about complexity we always mean asymptotic complexity.
Since the algorithms are essentially the same, time complexity is the same.
Instead, if you want to talk about performance, then yes, there is a difference.
However, developers should write code for other developers, not for the machine.
If it is easier to read, understand, and extend, it is worth the slight performance overhead.
And anyway, in most cases there is a ton of underlying framework code impacting performance already, so things like using a map instead of a for loop will not matter.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
When talking about complexity we always mean asymptotic complexity.
Since the algorithms are essentially the same, time complexity is the same.
Instead, if you want to talk about performance, then yes, there is a difference.
However, developers should write code for other developers, not for the machine.
If it is easier to read, understand, and extend, it is worth the slight performance overhead.
And anyway, in most cases there is a ton of underlying framework code impacting performance already, so things like using a map instead of a for loop will not matter.