Main Page | Modules | Related Pages

Improving compile time

You probably noticed the time to compile a rather large project is pretty time intensive. This is mostly because of the huge amount of graphic- and sound-data which get compiled everytime.

So the first thing you should do is to remove the clean call from the all target in your project makefile. This call is usually in each template and demo project which comes along with HAM. For small projects it does not make a big difference though.

The next evil thing I have seen so many times in the HAM forum and sourcecodes is to include graphics! Graphicdata is usually a lot and it does not make sense to include them. Now I hear you say 'why is it in most of the HAM demos then?'. Well, I tried to hold them as simple as possible, so you don't wonder where file xy comes from.

However, imagine you include 3MB data in main.c, now when you only change one letter in it, it includes all the graphics again and must compile them -- that hurts!

It makes much more sense to compile them once and then only link them. This way they get only compiled when they have changed. To gain even for time, do not convert the graphics into a C array. GCC generates an assembly file from all C/C++ sources it compiles. So having it as a huge C array, it's first 'converted' into assembler code and then into an object file (*.o). The easiest way is to convert the graphics directly into assembler code. This works quite good and is a lot(!) faster than the C/C++ method.

Another option would be to incbin the RAW data. incbin is super fast! But this also has some drawbacks, because as far as I know, you must keep track of alignment and this could be a real pain. (if anyone knows how to auto-align them, without sending them through another toolchain to pad all RAW files, then please let me know, I'm very interessted in it).

Hope it helps :)


Generated on Mon Aug 22 20:43:40 2005 by DoxyGen 1.4.4