Xref: utzoo rec.games.programmer:3396 comp.os.msdos.programmer:4601 comp.graphics:17196 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!deccrl!bloom-beacon!bloom-picayune.mit.edu!ahodgson From: ahodgson@athena.mit.edu (Antony Hodgson) Newsgroups: rec.games.programmer,comp.os.msdos.programmer,comp.graphics Subject: Re: Need hard core help doing some 3d optimizations Message-ID: <1991Apr12.140949.26414@athena.mit.edu> Date: 12 Apr 91 14:09:49 GMT References: <27979@uflorida.cis.ufl.EDU> <1991Apr11.202429.29648@kuhub.cc.ukans.edu> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 23 In article <1991Apr11.202429.29648@kuhub.cc.ukans.edu> 2fmlcalls@kuhub.cc.ukans.edu writes: >> I just ran Turbo Profiler on some code of mine, and it looks like roughly >> 90% of my CPU time is being shoved into one function. Any help on the >> optimizations would be really appreciated. >> ... float xa, ya, za; > >I don't fully follow C, but I know float. Go with scaled integers or longs and >use integer division. Check out the latest Dr. Dobb's journal on using memory-mapped math coprocessors. They claim that float division is not faster than 386 integer division on some PC hardware platforms. >As well, use scaled integers for your sin/co look=up >tables (i.e. sin(45 degrees) = 707 rather than 0.707). When you are through >multiplying, do a div 1000 (or C equivalent of integer division). If you go this route, don't scale in base 10; scale in base 2 and use shift operations instead of division when possible. Tony Hodgson ahodgson@hstbme.mit.edu