optimization isn't always about multi-threading and optimizing hardware utilization. in fact, most performance work is about simply doing less.tantan's video...
Generally the performance difference will be minimal, but the benefit to others (and yourself in the future) in keeping the code’s functionality clear and readable is much more important, especially in a professional setting.
A lot of programmers do have this ‘code golf’ mentality that less lines == efficient, but unless its a bottleneck and you’ve benchmarked it to be significantly faster, code readability should always trump performance.
Less code is not a positive metric to measure your implementation by, and is not a valid premise to justify itself. Often increasing the complexity (again, LOC is not an indicator of complexity), tanking performance, and harming the debugging experience is a common result of the mentality. Things that make software worse.
Not all one-liners are bad ofc, that’s not the argument I’m making. It’s about the mentality that less code is more good, where poor decisions are made on a flawed premise.
Generally the performance difference will be minimal, but the benefit to others (and yourself in the future) in keeping the code’s functionality clear and readable is much more important, especially in a professional setting.
A lot of programmers do have this ‘code golf’ mentality that less lines == efficient, but unless its a bottleneck and you’ve benchmarked it to be significantly faster, code readability should always trump performance.
Hard agree.
Less code is not a positive metric to measure your implementation by, and is not a valid premise to justify itself. Often increasing the complexity (again, LOC is not an indicator of complexity), tanking performance, and harming the debugging experience is a common result of the mentality. Things that make software worse.
Not all one-liners are bad ofc, that’s not the argument I’m making. It’s about the mentality that less code is more good, where poor decisions are made on a flawed premise.