Path: chuka.playstation.co.uk!tjs From: tjs@cs.monash.edu.au (Toby Sargeant) Newsgroups: scee.yaroze.beginners Subject: Re: Plotting 2D Boxes in a 3D World (+ faster code hint!) Date: 15 May 1998 02:31:16 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 33 Message-ID: References: <355a3dc2.2999054@news.playstation.co.uk> <355A67EA.137C@mdx.ac.uk> <355B0CD4.2A85@writeme.com> <355B86AD.3C0@manc.u-net.com> <6jg24u$f4o3@chuka.playstation.co.uk> NNTP-Posting-Host: indy16.cs.monash.edu.au X-Newsreader: slrn (0.9.5.1 UNIX) On Fri, 15 May 1998 01:26:46 +0100, JohnT wrote: >This is so true. I used to program assembly on my Atari STE and I found that >for fast graphics I had to use shifting. I took those ideas over to C >programming when I started on that. It's amazing how many programmers don't >bother with this sort of thing just because of the power of the processors. >If games (PC, PSX or whatever) where still programmed using those speed >enhancing tips from assembly programmers working on slower machines the game >would not need half as much processing power that they do these days. The STE was a 68000 processor, right? That would mean a table lookup would have been faster than shifts, which would have been faster than those wonderful 68 (or there abouts...) cycle multiplies. on the R3000, shifts are still faster than multiplies, although the processor isn't sitting idle during that time, so if you can use the delay slots, then you don't lose out. the fact is though, that all optimising compilers will take constant multiplies and turn them into shifts if it's faster to do it that way. the other thing is that it's optimisation on an algorithmic level, rather than on an instruction level that gives most performance improvements. so basically, if you're writing anything other than assembly, it's not worth the extra effort to write things out explicitly as shifts. in fact they *might* confuse the compiler, so that the end result is worse. caches, better processors, and optimising compilers mean that optimisation techniques of 5-10 years ago are much less useful than they were. toby.