Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Branch Misses

Name: Anonymous 2011-09-26 17:26

How bad do branch misses hurt a programs performance? In C and Java?

for example how big of an impact would :


int shitinanus()
{
    int val = getanus();
    if(val != 0)
        return ANALTONIGHT;
    return ALONETONIGHT;
}


be knowing that val will most likely be 0 99% of the time compared to the below function


int shitinanus()
{
    int val = getanus();
    if(val == 0)
        return ALONETONIGHT;
    return ANALTONIGHT;
}

Name: Anonymous 2011-09-26 19:44

>>8
There's only one reliable source regarding assembly-level code optimization: the processor manuals. Everything else is either bullshit, or just resaying what the manuals already say.

Intel has a book dedicated to that subject, for IA-32: http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-optimization-manual.html. It's a very interesting book, albeit the reading is rather deep.

But it'll probably be of more use if you look for profiling techniques. Search for oprofile and gprof for a starting point. These tools are typically enough to detect real bottlenecks on profilable code.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List