Re: C style math libraries versus "proper" C++ maths

Andras Balogh <[email protected]> Sat, 25 Mar 2006 15:42:52 -0700
Newsgroups gmane.games.devel.general
Message-ID <[email protected]>
Isn't it fun when theory meets practice? :)

With a proper compiler, if you used references, and the function was
inlined, then the function should just work straight on the values, no
dereferencing, no copying to the stack, etc.. However, last time I
checked, this was still not the case, so I still pass all my vectors
and matrices by value, rather than reference.

Note that if the function is inlined, then it shouldn't do the copy to
stack in any case.. So my advice would be to simply pass by value.



Andras

Saturday, March 25, 2006, 3:26:53 PM, you wrote:

> I remember some passed days in gameprogramming.
>  
> 3D matrix operations and its implementation on PIII900MHz.
> a class containing an array of float, somethingvery simple.
> And for basic operation, you can pass on reference(using  
> keyword) or pointer (* keyword) or pass directly the array (so
> allfloats are placed into stack.
> Case 1   Case 2 : only 4 bytes on the stack butall computing is using a deference (-> operator)
> Case 3 : for 4x4 array (x,y,z,w), 16 floats so 16 x4 = 64 bytes per matrix.
>  
> At this time the fastest method was the3.
>  
> So better code isn't always the faster one;)
>  
  



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Gamedevlists-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=557