Path: chuka.playstation.co.uk!chuka.playstation.co.uk!chuka.playstation.co.uk!not-for-mail From: Lewis_Evans@Playstation.sony.com Newsgroups: scee.yaroze.programming.gnu_compiler Subject: -O Optimising levels Date: 12 Mar 1998 15:49:12 -0000 Organization: Sony Computer Entertainment Europe - 119.SS5 Lines: 56 Sender: news@chuka.playstation.co.uk Message-ID: <6e905o$sv61@emeka.playstation.co.uk> Reply-To: Lewis_Evans@Playstation.sony.com NNTP-Posting-Host: emeka.playstation.co.uk From: Lewis_Evans@Playstation.sony.com To: news@playstation.co.uk Firstly, odd-sized arrays are saving very little memory, so best to make them even-sized. As regards this buffering business, I can't say because I haven't seen your code and don't know what you mean by 'single virtual screen without double buffering' during game. (Do you write everything to the same rectangular offscreen area of VRAM each frame, and then MoveImage to whichever buffer is being drawn/displayed??). One thing that definitely needs looking at under optimisation: function calling and local variables. Without optimisation, the locals are accessed by the frame pointer, but with O, they're accessed via the stack pointer. If you put the program stack onto the data-cache for higher speed, but try to access locals, you get a nasty trouble because the stack pointer's moved and locals will not be accessed correctly, and you can expect all kinds of trouble. Other than that, try isolating which part(s) of the code are going astray under optimisation, and use -O2 because that's bestest (highest level before you get to O3 which unrolls loops, sounds great but on the PSX is very liable to give you instruction cache misses and hence anti-optimisation). Lewis Hey there people, If you haven't already seen Gravitation I suggest you check it out now -- a must for fans of the Thrust genre. I've done a lot of optimising the code from my early demos (such as removing the floating point numbers, and using sprites for bullets) and it seems to run perfectly okay without a -O compiler option. BUT when I use any optimising things go pear-shaped! I use a mixture of single and double buffering (single buffer virtual screen during play, and double buffering for intro/menus) and for some reason this is the first to go nuts, although I've had the game crash in mid play once. Is it something to do with having your data structures odd sizes? (Like using an array[7] instead of an even array[8]?) Anything obvious I've missed? Thanks, Jim -- ----------------------------------------- James Shaughnessy james@manc.u-net.com http://www.netyaroze-europe.com/~shaughnj -----------------------------------------