{Little off Topic} Speeding up the main thread?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

{Little off Topic} Speeding up the main thread?

Post by devsh »

The one that does all the rendering.

Well is there a way that i could possibly set the priority of the thread to high??

excluding the linux nice -20

or a way to force all other threads off CPU0 and start the main game on CPU1??
so the CPU1 is all for the game?

This would give a large boost on dual core i think.

And lastly when my game starts other threads (only sound ATM but could be extended to texture streaming and certainly physics), can I make sure they run on the OTHER CPU?
tomhancocks
Posts: 15
Joined: Fri Jan 02, 2009 1:25 pm
Location: Around
Contact:

Post by tomhancocks »

Although most of my programming experience isn't from games/3d development or C++ even I do have a fair amount of experience in writing data parsers and handling large sets of data in C/Objective-C so I will give you some advice based on my experiences. If any bits of this don't apply to C++ please excuse it.

Trying to speed up a thread by brute force isn't really a good idea because you simply don't/can't know the conditions of the computer which the app/game is ultimately going to be running. You need to go through your code (breakpoints and a debugger are very useful) line by line and see what can be optimised.

For example, is there any calculations which your doing repeatedly that only need to be done once? Are you releasing/clearing memory when your done with it, or are you holding on to it. How much stuff is allocated at any one time, and what kind of overhead is it all creating.

How long are you sitting inside loops? Is it possible to add extra conditions to those loops to be able to break out of them earlier if needed? Pointless allowing a loop to continue executing longer than actually needed. It will all add up.

The majority of the time if your code is running slowly then its probably a problem with your code.

Just my advice from my experience.
Hope that helps,
Tom
Post Reply