That was part of the lesson, really. In practice any of the implementations would be "fast enough". The speed of this function does make a measurable difference to the run-time, but measurable isn't the same as significant; the entire program currently spends maybe two minutes a day running, so even if that was all spent in these routines, it still wouldn't make much difference.
(I didn't profile before I started; I went straight to optimisation mode because this particular routine involved Other People's Code and it Looked Inefficient. Hubris again.)
I wrote the final version purely out of curiosity, and it put things so firmly in perspective that I just had to write it up.
In reply to Re^2: Sweating the small stuff: a lesson in optimisation
by Porculus
in thread Sweating the small stuff: a lesson in optimisation
by Porculus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |