False IF statements SLOWING THE LOOP DOWN?

Hey Everyone,

I have some code I'm working on for an arduino project. My main loop is taking too much time to cycle at the moment, so I started commenting out sections and measuring the cycles/second of the main loop with the millis() function so I could see what parts of the code are taking the longest to execute.

Now, I have 2 if statements and 1 while loop that contain code around 10kb in size, but they are never found to be true unless the arduino gets a very specific serial signal. However, when I commented them out the cycles/second of my main loop increase by the tens of thousands... :fearful:

Just in case something in my code was making the if and while statements true I entered 0 in all the brackets. Yet, they still seem to slow down my main loop by tens of thousands of cycles...

Can if or while loops slow down the main loop if they are never executed? I know the if or while check is in itself a command and requires clock cycles to make the check, but it shouldn't affect the speed when there are only 2 or 3 if statements in the whole main loop.

Any thoughts?

p.s. no, I am not doing a do-while loop, just the regular while, so it's never being executed.

No, you made a mistake somewhere else.

Are we allowed to see the code?

Thanks, just having someone confirm that that is impossible helps.

I transferred the code into a new arduino project, seemed to solve the issue... So I guess I made a mistake somewhere. Thanks for the taking the time to answer my newb post!

Next time please post your code. This thread hasn't achieved much.