above what others suggest:
Limit the use of C ++ functions, write as in ANSI C with small extensions. Standard templates (std: :) use a large dynamic allocation system. If possible, do not use templates at all. Although not malicious, they make it too easy to generate many, many machine code in just a couple of simple, clean, elegant, high-level instructions. This encourages writing in such a way that, despite all the benefits of "clean code," it is very hungry.
If you must use templates, write your own or use ones that are intended to be used as built-in ones, pass fixed sizes as template parameters and write a test program so that you can test your template and check your -S output to make sure the compiler is not creating horrible assembler code to create it.
Align your structures manually or use the #pragma pack
{char a; long b; char c; long d; char e; char f; }
For the same reason, use a centralized global data storage structure instead of scattered local static variables.
Intelligent balancing using malloc () / new and static structures.
If you need some of the functionality of this library, consider writing your own.
Expand the short loops.
for(i=0;i<3;i++){ transform_vector[i]; }
more than
transform_vector[0]; transform_vector[1]; transform_vector[2];
Do not do this for longer ones.
Pack multiple files together to compile short short compiler functions and perform various optimizations. Linker can't.
Sf. Jan 19 '10 at 12:10 2010-01-19 12:10
source share