On 13-Oct-06, at 2:34 AM, Ronald Vogelaar wrote:

----- Original Message ----- From: "Frank Condello" <[EMAIL PROTECTED]>

For some apps you can see improvements by reducing function calls in the order of thousands or even just hundreds, never mind millions. I've seen real-world measurable speed ups by manually inlining methods and otherwise reducing function calls by using pointers. I mean "seen" literally, saving just a few milliseconds per frame in a game really adds up for example - even a seemingly modest 10FPS jump can turn an unplayable game into an enjoyable experience.

I deliberately used an example of which the code (incrementing a counter) is among the simplest to achieve for a compiler. Therefore, I figured, measured time would most effectively and truthfully render the overhead of a function call over longhand code. Now, I'm not familiar with gaming (I don't even play computer games, let alone create them), and I'm not sure I follow you when you speak of reducing function calls by using pointers to create a significant speedup. I just don't see where the speedup would have to come from. Could you give an example?

I'm referring specifically to memoryblocks:

  // function call
  block.SingleValue(n) = 0.0
        
  // no function call
  blockPtr = block
  blockPtr.Single(n) = 0.0

For 3D animations you're often pushing around arrays of hundreds or thousands of vectors every frame, and in my experience the direct Ptr manipulation is easily 5-10 times faster. Admittedly Memoryblock accessors like SingleValue are more expensive than a simple "increment" method, but I'd imagine inlining all my Vector and Quaternion class functions would yield immediate benefits. It's not uncommon to write math libraries as a set of macros in C code for the same reasons.

Frank.
<http://developer.chaoticbox.com/>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to