User talk:Average/Optimize

From HackerspaceWiki
Jump to: navigation, search

Crucible #4 ensures your programming style doesn't turn into excess and bloat. You should know that there are Memory vs. Processing trade-offs for everything and that's the challenge of this crucible.

For example, you can make a hash table instead of searching through a linear array, but you'll use well-over twice the memory. Is it better? Depends on your constraints, constraints that are outside this little guide, like user-requirements: minimum response times and machine capacity limits.

Another hint here is to design your default cases for minimizing overhead, not for the most popular use-case. A new user experimenting with your code, should have a clean, slim implementation. 80% of users might use a different option, and experienced users won't mind setting a default value.

The two parts of the ally here are: LessenMemoryFootprint vs. MinimizeWork.