Donít Optimise Too Early
Make your system work first, make it fast second
Remember: good design and good testing and a stable system help optimisation
Do high-level optimisations first
Delay low-level optimisations until they canít be avoided: often they can!
Remember Knuth: Premature optimisation is the root of all evil!
EXAMPLE: Z80 emulator at uni: someone wrote inline assembler to speed up common instructions, but tools cranky and unreliable. Turned out in end that system was too fast even in plain C (to simulate a Sinclair Spectrum on a Sun 3/60) and the inline code was never used.
- Have you sorted out the high-level things (such as good algorithms) before tinkering at a low level?
- Put off low-level and non-reusable optimisations (eg inline assembler) until design is mature and all other avenues closed.