Optimization
However, this whole thing’s got me thinking. Programmers worry too much about minutia of execution when they should simply be following some key principles:
1. Be fanatical about your IO. Prefer smaller data sets to large ones but don’t skimp on boundary markers and type data that will allow you to version the software. Write big chunks.
2. Watch your cached and held data like a hawk. Just because you’re only storing a single object or pointer doesn’t mean you just haven’t referenced a giant object tree. Protect your caches from explosive growth. Don’t hold data you don’t need.
3. Worry about data conversions and data copying. Parse, copy, translate or whatever, as few times as possible. Uses references into the raw data blocks rather then duplicate the data if possible.
4. Don’t execute code that’s not needed.
Most performance issues can be addressed by just focusing on these simple principles. There’s seldom any need for magic solutions like the one described at the start of this post. I contend, as well, that following these basic principles isn’t premature optimization; It’s just smart coding.
A favorite mantra of mine is K.I.S.S. - Keep It Simple, Stupid. I believe however that keeping things simple doesn’t necessarily mean simplistic. Rather, I think it means focusing on the core code values such as I’ve stated above.
Comments