Xref: utzoo rec.games.programmer:3397 comp.os.msdos.programmer:4602 comp.graphics:17197 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uwm.edu!linac!att!ucbvax!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.142449.26807@athena.mit.edu> Date: 12 Apr 91 14:24: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: 22 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. > >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. In an article on memory mapped numeric coprocessors, they claim that floating point division is now faster than 386 integer division with the appropriate math coprocessor attached. >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, consider scaling by a power of 2 rather than a power of 10. You may be able to carry out divisions by shift operations rather than division operations. Tony Hodgson ahodgson@hstbme.mit.edu