computerquip, you didn't understand the KISS rule.
It's obvious that sometimes, you can do many great optimizations that will be fast as hell, but complicated or not clear at the first sight.
And KISS says, these shouldn't be used too much.
It doesn't say, that if you follow KISS you will write the fastest code. But often you don't need to. If you write really slow code, it's bad. But if you try to optimize everything, it's even worse.
Many beginners focus too much on optimizing, because they hear everywhere that code must be fast, optimized, etc. We live in XXI century, we have fast PCs. As Donald Knuth said:
Premature optimization is the root of all evil |
If you can write two lines, either:
or
Write the latter. Your intentions are clear, and you are less likely to make a mistake.
If you are writing some simple game, where you need to sort equipement, don't think too much about all the sorting algorithms - use quicksort. If it is too slow, you will have to change one function, and quicksort is well known, so nobody will have to think about how it sorts.
Sometimes it's better to write a little bit slower code, that is easier to maintain and read.