On Feb 26, 2012, at 6:59 PM, Tom Browder wrote:

> I found this tidbit while browsing news forums:
> 
>  
> http://hbfs.wordpress.com/2008/08/05/branchless-equivalents-of-simple-functions/
> 
> May be helpful when doing power optimizing for hot spots, or do modern
> compilers already optimize for that?

Most of the hot spots in our code are already optimized to minimize branching, 
but usually a good thing to profile for regardless.  Always room for 
improvement.

That's been a performance tweak for quite a number of years now.  It used to be 
that the compiler wouldn't reliably inline and the call-stack overhead is 
worse.  Tricks like tiny function calls can make things far worse for some 
environments.  These days, though, compilers usually obey the inline hint and 
are good at optimizing stack frames so it's a good idea to minimize branching.

A good performance counter profiler (like Shark on Mac) will point out 
branching hot spots very quickly.  It's rarely as simple as the sex() function 
trick in that blog post, though.

Cheers!
Sean
 



------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to