From: Alistair Bain Newsgroups: comp.os.msdos.djgpp Subject: Code optimisations Date: Tue, 4 Nov 1997 23:27:06 +0000 Sender: Alistair Bain Distribution: world Message-ID: NNTP-Posting-Host: pulsedesign.demon.co.uk MIME-Version: 1.0 Lines: 25 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Ok don't want to start a war here but... I'm new-ish to C and I am looking for ways to speed up my code. I don't care a whit about readability and maitainability of code, or the size of code generated (As long as it runs on clean 16Mb system). I just want the best performance poss. (for games programming). 1) structs - Are they slow? what do they compile to? 2) unrolling loops - to what extent does -funroll-loops do this? Does - O3 do this? Adding both I get an excecutable of exactly the same size as using just -O. Should I just manually unroll the loops? 3) global variables - I heard, read, dreamt something about them being faster. ie declare all variables at top of prog and just be careful about accessing wrong ones, etc. Any help appreciated. Self-proclaimed gods need not reply. Remove the (you know what) to Reply -- Alistair Bain AHBain AT NOSPAMPLEASEWEREBRITISH DOT pulsedesign DOT demon DOT co DOT uk