Quote:
No, I wouldn't code with implicit conversions, because it's not about "easier to read" it's about "easier to maintain". It's about the process of going from the code displayed on screen to a sufficiently accurate mental model of the intent of the code in the programmer's head. Implicit conversions may transfer the textual representation into your brain more easily, but then you need to figure out where all the converting occurs, which makes it harder to understand.
If it comes down to a choice between fast or clear then I would definitely choose clear on the first pass. The reason is that it's very easier to sacrifice the clarity for speed if you need to, but it is much harder to understand that fast code later. Since it is much more likely that you need to modify code for bugs or changing requirements than you are to need to improve its performance, it is always worth striving for the clarity over speed.
Also, the question on performance isn't "which is faster", it should be "which is fast enough?". If you have two approaches, and only one meets your performance budget (whether that be speed (with all its sub categories [time-to-first-byte, time-to-last-byte, throughput]), memory, power consumption, etc), then you clearly need to use that approach. If neither meets your performance budget, well then you've got a problem. If both meet your performance budget then you choose the clearest code - even if it isn't the fastest. Note that all this assumes you have a performance requirement you need to meet. If you don't have a performance requirement (and, no, "must be fast" isn't a performance requirement) then you don't have a performance problem - and prematurely optimising before you have any performance data has the potential to make your performance worse. Also, optimising in one area could cause a bigger slowdown somewhere else.
That all sounds good to me. I recognize that part of my views comes from working on a series of projects that have real potential for running into slowdowns due to the likelihood of having LOTS of iterations, but often unknown numbers of iterations. That situation argues for watching the time taken in any one particular iteration. A type of program that I tend to work on a fair amount where this applies would be Genetic Algorithms, where each individual generation is trivial...but there are so MANY of them. Still, in a general business app, I think I would do it the way you suggest.