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 / Better performance with GDK?

Author
Message
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 20th Jun 2008 18:56 Edited at: 20th Jun 2008 20:39
I'm considering moving my current project over to GDK from DBPro. Since the core of DBPro is written in C++ (if I've heard correctly) and GDK is used in C++, can I expect much better performance?

Also, how about GDK.Net. If I choose to use VB.Net instead of C++ any comments on what that might do to performance?

[edit]
Ok, I did some more searching and found that for the most part GDK will be faster, most noticable in the area of code and calculations that don't rely on the DGDK code. The DGDK code (for rendering and such) sounds like it will be about the same.

The hold up seems to be caused by the sync rate being tied to the refresh rate of the monitor. So users with a higher refresh will get a higher FPS. (unless I misunderstood the conversation in a thread I found about that..)

OR

Is it that the FPS calculation is tied to that, but the main loop may not be. Maybe a test displaying Loops Per Second would reveal just how fast it's going.
[/edit]

dark coder
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 21st Jun 2008 01:45
The GDK functions are pretty much the exact same as the ones used in DBP, the only difference unless I'm mistaken is that the GDK ones lack code to trap any errors(or at least I've never seen any exceptions being thrown) and that it's in a static library, rather than DBP's dynamic library.

As you stated, the speed gain is when you use the actual language itself, and not the GDK library, same with DBP using actual core of the language, calling functions/adding variables etc etc is where the difference is. Even incrementing a single variable in a loop is faster in c++ as DBP does many redundant error checks. But if you want to see a major speed difference don't do a simple spinning cube or something that relies mainly on GDK, something far more complex, such as lightmapping, AI or anything that is more CPU intensive will prevail. Also remember that the MSVC compiler is very good, if you enable all the optimizations you can easily get 4-6+ times faster(depending on the code) than any DBP code that does the same thing, not to mention the wider range of extra features you have, great debugger, decent IDE etc.

aersixb9
16
Years of Service
User Offline
Joined: 29th Nov 2007
Location:
Posted: 21st Jun 2008 04:59
I've found speed is more in how you write in than in what language you write it in. As long as it isn't Java.

http://overspace.panddpictures.net
SourceForge: OverSpace
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 21st Jun 2008 05:04
Very true. But, just like Java has its own reasons for less-than-optimal performance, DBPro has its drawbacks.
waka324
16
Years of Service
User Offline
Joined: 31st Mar 2008
Location:
Posted: 21st Jun 2008 08:15
Its all in the compiler.

DarkGDK is not only faster becuase of the compiling engine (VC++), but also much more stable.
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 21st Jun 2008 15:34
"dark coder" is correct.

Using C/C++ you have the option of doing things in a much faster manner.

For example you may want to control 100 movables inside of a loop.

To do this you can make your loop variable an unsigned Byte variable where it is one simple machine code step to increment the value every pass through the loop.
Using The BASIC language it will take roughly one dozen machine code instructions to increment a value if you are not careful.

You can do things like left shift or right shift operations on a Byte value or DByte value to multiply it by 2 or divide it by 2.
Again a simple one instruction machine code operation, compared to an order of magnitude larger machine code tasks using normal multiplication or division in BASIC.

It basically comes down to learning the strengths of the C/C++ language and rewriting the code in a new format that allows you to use the strengths of the program.

If speed becomes very critical, then you may even switch your writing style back to structured C programming rather than OO based C++ programming (OO has substantial overheads and also leads to program bloat, but it has other advantages also).

I have the requirements to keep track of 1000+ bullets in the air at the same time as well as 200+ aircraft, so I will be staying with structured C and tying in a bit of machine code where necessary myself.
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 22nd Jun 2008 00:49
@sydbod - Nice. I wish I had kept up with my studies of assmbler..

@Dark Coder - Ok, that's pretty much what I thought. The switch also gives me the ability to use RakNet directly, which will be MUCH faster.

Login to post a reply

Server time is: 2024-11-20 15:31:51
Your offset time is: 2024-11-20 15:31:51