|
From: Roger H. <rog...@mi...> - 2005-01-28 12:54:08
|
On Wednesday, January 26, 2005, at 07:44 pm, James W. Walker wrote: > Roger Holmes <rog...@mi...> wrote: > >> 9.7% of the time in sqrt. I have switched my renderer to use >> std::sqrtf as >> it only ever handle floats, never doubles. Hopefully will speed >> things up. > > Here's a quote from a recent thread on Apple's performance > optimization mailing list: > > At 4:44 PM +0000 1/23/05, Jerry wrote: >>>> This should be faster, since it need compute fewer >>>> bits of precision, but it is still returning the correct result, >>>> rounded to a float. >>> >>> On some architectures. On others the calculations will be in double >>> precision and shortened to float on return. >> >> This is exactly what libmx does on OS X (try stepping into it in the >> debugger), so switching to the "f" functions may actually slow you >> down. > > Moral: Don't just hope, test. Later on I did, and the times were identical. > > When Shark sees often-used square root operations, it suggests that if > you don't need full precision, you can use a special PowerPC > instruction, frsqrte, floating reciprocal square root estimate. I > don't know if we want to get into platform-dependent optimizations > though. Do they suggest how to generate such code from a high level language ? > >> I think in the release version we are checking out inputs too often, >> for instance >> in E3Shared_Acquire we check the parameter is of type shared. We then >> call >> Q3Shared_GetReference which again checks its parameter is of type >> shared. >> It also calls E3System_Bottleneck even though we must have come into >> E3Shared_Acquire from a Q3 routine which will have already called >> E3System_Bottleneck. >> >> My question is this, can I change the call to Q3Shared_GetReference >> into a >> call of E3Shared::GetReference (my preferred option) or can I remove >> the >> check in E3Shared_Acquire or should I leave it alone? > > It's OK with me if you change the Q3Shared_GetReference to > E3Shared::GetReference. > > As long as you're messing with E3Shared_Acquire, how about combining > the two if (theObject != NULL) statements into one? Done. > >> Can I apply you answer to all similar situations or should I ask >> every time? > > You may apply my answer in similar situations. Thanks. |