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.

2D All the way! / PlayBasic Threading Test

Author
Message
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 22nd Feb 2009 16:12 Edited at: 25th Mar 2011 07:15
PlayBasic Threading Test

This example is an experiment that I've had on my mind for some time now. The objective is to try threading some of the rendering from within a PlayBasic program. The purpose of this, is to split the work load on machines with multi core cpu's. While it works without multi core, the benefit (if any) will be lost. Since the same cpu is running both threads.

So ideally the second cpu could be used to asynchronously render in the background while the main cpu runs the program code (in this case the game logic). In this example, only the back drop fill (shadebox) in bring executed as a thread. While this occurs, the demo moves some ship objects from left to the right. The ships (the circle things) rendered once the thread closes. Which should be obvious, If you think about it.

So the drawing loop looks a bit like this.



While the example is written in the stock standard version of 1.63w, it's about as user friendly as a hole in the head. Much like the JIT test a few months ago. So this is just test, nothing more ATM. The main problem with doing this from 1.63 is that only a few tid bits can be threaded safely. The key being safely here, as if you don't know what your doing or how PB works, then this is not for you.

Ultimately i'd like to integrate some level of threaded functionality right across the engine. While this is not possible in 1.63w, who knows in the future.


Keys

Esc = Quit

Space = Change from single <> threaded. (defaults to single.. no threading)

Left / Right Arrows = Thread Priority. (when in threaded mode)



Download

Get Thread Test Demo




Note:

This is actually an older tech demo from our private developer forums. What i'm really interested in with this pubic test, is if SINGLE CORE CPU's with HYPER THREADING get any signification gain.

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 22nd Feb 2009 17:59
kevin,

i know you want single core tests, but i tried it anyway for comparison purposes

some multi-core results:

single:
87 FPS

multi**:
55 FPS


when i opened task manager and ran it along side:

single:
139 FPS
CPU @ 22%

multi**:
87 FPS
CPU @ 30%

**multi results the same, regardless of thread priority.

if i minimized task manager or simply put the focus back on the demo, results returned to the first set above. i guess it's skipping the input checks if the demo window doesn't have the focus?

specs in sig.

Virtual Nomad @ California, USA
AMD Phenomâ„¢ X4 9750 Quad-Core @ 2.4 GHz . 8 GB PC2-6400 RAM
ATI Radeon HD 3650 @ 512 MB . Vista Home Premium 64 Bit
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 23rd Feb 2009 05:35
Thanks for giving it a shot. It's already been pretty well test on a number dual & quad core systems, and even though only the backdrop fill is threaded, the results are consistently in the 150->300fps range. However, this systems results are interesting as it now has the rather dubious honor of getting the second slowest result post to date.

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 23rd Feb 2009 20:50
ouch! why's my system so slow? it's slower than i would expect on lots of things compared to my old 1.6 ghz athlon with 1.5gb ram, 128mb agp radeon... can the new w/s lcd HD monitor be it? is it a vista64 vs xp thing? this 'upgrade' wasn't such a good thing (old sys died so bought new system)

sorry to go off on a tangent

Virtual Nomad @ California, USA
AMD Phenomâ„¢ X4 9750 Quad-Core @ 2.4 GHz . 8 GB PC2-6400 RAM
ATI Radeon HD 3650 @ 512 MB . Vista Home Premium 64 Bit

Login to post a reply

Server time is: 2024-03-28 19:52:22
Your offset time is: 2024-03-28 19:52:22