Path: chuka.playstation.co.uk!news From: Peter Passmore Newsgroups: scee.yaroze.freetalk.english Subject: Speed Optimisation Date: Mon, 23 Feb 1998 19:56:49 +0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 41 Message-ID: <34F1D481.5FFF@mdx.ac.uk> Reply-To: p.passmore@mdx.ac.uk NNTP-Posting-Host: dynws25.mdx.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01 (Win95; I) Hi, I've been mailed about speed optimisation and decided I didn't have a comprehensive answer. Obviously different games may implement different game specific optimisation and optimisation for speed will often be at the cost of space. However there should be a generic set of optimisations that should apply to the PSX and its libraries. Off the top of my head I came up with the following, probably wrong in part, and certainly incomplete suggestions. Can anybody add to it? - Set the stack to use the D-cache if possible (set scott evans' http://www.netyaroze-europe.com/~sevans/tech.htm scee page for a detailed account on this). - Reduce the number of polygons in models to the absolute minimum. - Make textures as small as possible. - Only draw the part of the world that is immediately visible (in 3D games). - Define small often called functions as macros wherever possible. - Use variables which are the same size as the registers (eg unsigned long) where ever possible. - Use lookup tables to replace calculations where calculations are expensive (eg: floating point, trig functions etc) - Otherwise avoid any floating point arithmetic. - Avoid texturing and shading models where unneccessary (in 3D games). - Clump functions that call each other together in the code in the hope that they get compiled contiguously in memory and they have more chance of being loaded into the cache together - (actually this is supersition, I haven't proved to myself that this works on the PSX). - Use bit shift operations for maths where possible. And its possible that some traditional optimisation techniques may be inappropriate: - eg: loop unrolling was a good optimisation on primitive architectures but not neccessarily more modern ones. Peter.