by breadbox · 11y ago · 0 comments
Encapsulate your #ifdefs people!
Its not really the classic case of premature optimization either. At least not in my experience. That's more like 'I know I need a spatial partition here, time to research all the ways they can be implemented and their performance tradoffs, and implement a really good one" when you should have just used a hash table and done the other stuff if spatial lookups even show up when profiling.
Stuff like this is way more damaging for both codebase complexity and productivity then anything else. The golden rule is to only do enough optimization to make it easy to do the optimizations you might need to do later, but no more.
IMHO I'd rather scroll over code I'm not interested in, than have to jump around to figure out what really happens if they are defined.