Optimizing code and managing your project

A forum to store posts deemed exceptionally wise and useful
CuteAlien
Admin
Posts: 9660
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Optimizing code and managing your project

Post by CuteAlien »

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.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
CuteAlien
Admin
Posts: 9660
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Optimizing code and managing your project

Post by CuteAlien »

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.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Optimizing code and managing your project

Post by REDDemon »

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).
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
CuteAlien
Admin
Posts: 9660
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Optimizing code and managing your project

Post by CuteAlien »

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.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Optimizing code and managing your project

Post by REDDemon »

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

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.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Post Reply