Optimizing code and managing your project

A forum to store posts deemed exceptionally wise and useful

Re: Optimizing code and managing your project

Postby CuteAlien » Wed Apr 18, 2012 8:19 pm

I'm not so sure about memcpy. Last time I profiled it against copying by hand it was definitely slower on my system (I think I tested with GCC on Windows and Linux, but it's been a while) - even with all optimizations enabled. But was also for a small array (the irrlicht-matrix).
IRC: #irrlicht on irc.freenode.net
My patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Games with Irrlicht: http://www.irrgheist.com/
News: http://www.reddit.com/r/irrlicht/
User avatar
CuteAlien
Admin
 
Posts: 5349
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Optimizing code and managing your project

Postby CuteAlien » Wed Apr 18, 2012 8:26 pm

About point 7: What you really want to do is have different targets for debug and release (and sometimes for retail as well). VS has already 2 by default (debug/release), so maybe that's why you thought it's easier. But you can create those in C::B as well. And then you don't change compiler settings for release, but just switch to the corresponding target which has those different settings.
IRC: #irrlicht on irc.freenode.net
My patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Games with Irrlicht: http://www.irrgheist.com/
News: http://www.reddit.com/r/irrlicht/
User avatar
CuteAlien
Admin
 
Posts: 5349
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Optimizing code and managing your project

Postby REDDemon » Fri Apr 20, 2012 5:19 am

point 7 is about wich compiler settings produces a faster application not about how many compiles target you have. so you are right, but wich is the fastest Release target? It's of course not always O2 (most used option for release anyway). There is people who tried to solve that problem by putting a different optimization for each source file (a little insane due to great number of possible solutions, but there is a lot of interest on that problem.) this is of course not possible with single compile units (wich can have just 1 setting). But is a solvable problem if you have several compile units (what you put on a compile unit depends on code design. If every compile unit is not depending on others that's the way to go since benefits of uniting indipendent code are almost null).
OpenGL is not hard. What you have to do is just explained in specifications. What is hard is dealing with poor OpenGL implementations.
User avatar
REDDemon
 
Posts: 831
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Optimizing code and managing your project

Postby CuteAlien » Fri Apr 20, 2012 8:25 am

Ah yes, that's an annoying problem in C::B (also the reason we can't get rid of some compile-warnings in the c files which only matter for c++).
IRC: #irrlicht on irc.freenode.net
My patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Games with Irrlicht: http://www.irrgheist.com/
News: http://www.reddit.com/r/irrlicht/
User avatar
CuteAlien
Admin
 
Posts: 5349
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Optimizing code and managing your project

Postby REDDemon » Sun Nov 18, 2012 11:09 pm

Nice trick I'm using in my projects, actually irrlicht is affected by this issue too.

When dealing with multiple/incomplete implementations compiler give warnings about unused parameters (well some parameter can be used in some implementation and since the API is the same can be unused in another implementation.. There's a nice way to fix that

cpp Code: Select all
 
void method(bool used_param, bool unused_param)
{
    (void) unused_param; //shut up compiler warnings without producing more assembly.
    if(used_param)
    //blabla
}
 


this can be usefull when warnings are UNWANTED (if they are unwanted depends on case and needs).

this also works FOR EVERY UNUSED EXPRESSION. Just cast the expression to void.
OpenGL is not hard. What you have to do is just explained in specifications. What is hard is dealing with poor OpenGL implementations.
User avatar
REDDemon
 
Posts: 831
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Previous

Return to FAQs, Tutorials, Howtos, and external tool lists

Who is online

Users browsing this forum: No registered users and 0 guests