Jun 15, 2022
I think it is baffling that people using your line of argument always ignore that the test for bailout condition comes with some cost in term of time and resources which is applied in every single step. I bet that this is in — by far most — cases actually more expensive — and therefore slower — than just simply iterating through the remaining container elements. especially since the bailout condition test can have any complexity itself, from checking a single boolean to calling several methods.