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.

Program Announcements / Benchmarked TGC's DBPro, DarkGDK & PureGDK

Author
Message
WLGfx
11
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 22nd Dec 2011 11:04
Wasn't sure which forum to put this... Sowwy...

It took soom time to get the last one completed in PureGDK but that was because I've been in pretty bad shape lately, but I got it done and managed to produce a "almost" realistic comparison between Dark Basic Pro, Dark GDK and Pure GDK.

It was originally intended that I write this simple game in Pure GDK first, but I started in Dark GDK first (16 days), then converted it to Dark Basic Pro (less than 36 hours) and then converted the Dark GDK version over to Pure GDK.

The results on my machine:


Converting the code to Dark Basic Pro was very easy and whilst doing it I threw in some of my own optimisations on the major "bottlenecking" routines. One such routine which bottlenecked the game was the calculating the closest tree. In both GDK versions I re-wrote these entirely in assembler code:

Dark Basic Pro version: (using the nested IF's, and local variables)


The GDK version (both Dark GDK and Pure GDK) in C++: (almost there optimised but still slow)


When I got to that point and looked through the disassembled code there was tons of unnecessary commands. So I re-wrote it completely in assembler and using just the registers (apart from curr_dist) to iterate through the loop. It ended up like this:

Three different versions of the same function.

The original compiled C++ code took over 3 times the above amount of assembly code. I've used the standard C++ function call to setup the local variables then jumped straight into the assembler. The only time the cache is held up is when it actually finds a tree within range, apart from that if the cpu has many pipelines in its cache it will run upto 6 asm instruction per cpu clock cycle. Probably more on the later processors. This is actualy so much faster even than drawing a 32 pixel by 32 pixel sprite to the screen, even on upto 10,000 iterations as it's cache friendly.

Other optimisations is asm where also made, mainly to the tree functions. Unfortunately these made no difference to the Dark GDK version, but did up the Pure GDK version by upto an extra 2 FPS. To be honest I was actually hoping that Pure GDK wouldn't be that far behind.

I believe the reason for Dark Basic Pro coming out on top is that the GDK version have to "call a function that calls a function". Pure GDK has been faster than Dark GDK from the beginning but with recently use it to convert this project over I have found that Dark GDK does offer a lot more internal function calls, although with a lot of persistence and advisably a very clear head (not half tired), you can get access to these.

Pure GDK is one I'm going to stick with for my upcoming projects and I'll still use DBPro to test out various things.

Gold - Dark Basic Pro
Silver - Pure GDK
Bronze - Dark GDK

Attached is all three versions DBP, Dark GDK and Pure GDK of the bike game. And I might look into benchmarking maybe some other function groups if anybody has any ideas of what to try out.

Thank you...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Attachments

Login to view attachments
Van B
Moderator
16
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 22nd Dec 2011 16:30
Interesting stuff. I'd like to see some pure math comparisons, maybe a cross reference of 100 spheres, so the distance between every sphere and every other sphere is calculated... comparing the native language of course, like using DBPro's built in SQRT, Purebasics, and C++. Also it might be interesting to see if SIN calculations differ between the platforms.

Health, Ammo, and bacon and eggs!
MrValentine
AGK Backer
8
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 24th Dec 2011 02:01
How about a tech demonstration of data streaming a vast environment as this is the only reason I plan to jump out of DBPro in an upcoming project.

Cheers

WLGfx
11
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 24th Dec 2011 09:44
I'm definitely sorting out some maths benchmarking, although I'd expect C/C++ to come out on top with the internal math.When it comes to any graphics operations I definitely would expect DBPro to win. I don't have PureBasic but I do have Pure GDK. The comparisons would be between DBPro and the GDK engine versions, with an added twist of an extra comparison of assembler optimised code. This will be to show that although calcs may generally be faster in DBPro, they can be quicker using standard C or asm optimised, integer and FPU math.

If anyone has any pointers to other Basic languages that are free or trial I'll run some tests on those too.

Some of the tests I want to throw in:

1. Integer and floating point engine math between DBPro and the two GDK's.
2. 2D drawing, 2D sprites, images and bitmap operations
3. 3D setup and shutdown, 3D operations

and some others... (simple ideas needed)

I've already got the DBPro setup on the way for the tests, actually now about to start the GDK versions.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Login to post a reply

Server time is: 2019-06-21 00:16:01
Your offset time is: 2019-06-21 00:16:01