Tuesday, September 21, 2010

Compile Times - The Mangling

I was thinking about how we normally go about optimising our compile times and wonder if anyone's actually taken the crazy step towards trying to optimise the source files themselves...

If we want to be able to parse text files really quickly, why not rename all your game identifiers so they are much smaller. Not human readable, but really really short, but still unique identifiers (much like the mini links you get from sites like tinyurl, or bit.ly).

I can't imaging we'll end up any larger than a 32 bit value for each identifier even sticking to the simple rules ([_a-zA-Z][_a-zA-Z0-9]*) you get 13,252,491 identifiers.

I might give this a go on a large project and see if it can actually increase the compilation speed. I can't think why it would increase the linking speed as it's already in machine form by that point, but it might still be using mangled names rather than pure lookup stuff, so might do something... worth a try, especially on really old and trusted stuff that doesn't need to be legible any more. And, I suppose as long as there is a reverse operation, it could be used for every day coding as a pre-parse before loading into and saving files out from your editor.

Still, sounds nuts anyway.