Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / [GDK2.0] dbSquaredLengthVector2 is a fps killer

Author
Message
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 15th Jul 2012 04:32
Using dbSquaredLengthVector2() only once per frame kills my fps.
Its faster to do this:
float D=((v.x*v.x)+(v.y*v.y));

The fastest code is the code never written.
Mistrel
Retired Moderator
18
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 15th Jul 2012 04:43 Edited at: 15th Jul 2012 04:44
GDK 2.0 does the exact same thing. How does it "kill" your fps?

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 15th Jul 2012 05:46


I don't know what is different, but when I use dbSquaredLengthVector2 I get 19fps and when I use the other, I get 123fps

The fastest code is the code never written.
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 15th Jul 2012 05:59
Quote: "I don't know what is different, but when I use dbSquaredLengthVector2 I get 19fps and when I use the other, I get 123fps"

It could be the overhead from the interface code to the DBPro DLLs. Other than that, I really don't know why the DarkGDK 2.0 function is so slow.

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 15th Jul 2012 15:36
I've also tested dbScaleVector4(..)

Here is my version:

Not only is it faster, it conforms to the same style as DirectX in that it also returns a value so it can be used as a parameter in a function.

Yea, I know 1M times! It took that many to get any significantly noticable difference on my machine. I wonder why GDK2 isn't using DirectX math variables in its functions. We could do the math and send the results to GDK functions much faster than sending them a special struct that is then converted to DX math.....

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-04-26 12:53:32
Your offset time is: 2024-04-26 12:53:32