|
From: James W. W. <ja...@wr...> - 2005-01-26 19:45:02
|
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. 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. >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? >Can I apply you answer to all similar situations or should I ask every time? You may apply my answer in similar situations. -- James W. Walker, ScriptPerfection Enterprises, Inc. <http://www.write-brain.com/> |