lundi 24 août 2015

If statement not executed slows program

I have an if statement that is currently never executed, however if I print something to the screen it takes over ten times longer for the program to run than if a variable is declared. Doing a bit of research online this seems to be some kind of branch prediction issue. Is there anything I can do to improve the program speed?

int vcr_new = 1;
if(!vcr_new) {

    Serial.print("test");
    // int x = 0; if print is commented out and this is uncommented program runs fast
}

Aucun commentaire:

Enregistrer un commentaire