Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance of C loops For Vs While Vs goto [duplicate]

Possible Duplicate:
C/C++: is GOTO faster than WHILE and FOR?

I know this has been asked for many times, but I never got an answer which satisfies me by googling.

I read somewhere that every loop(for/while/do-while/untill) will be eventually be converted to goto statements internally, Is that True?

If not, Which is the best loop to use as per the performance wise? Let me know if anybody knows?

like image 541
Anil Arrabole Avatar asked Dec 05 '25 16:12

Anil Arrabole


1 Answers

The correct answer is to learn enough assembly in order to read through your compiler's generated code.

However, these micro-optimizations usually don't matter (except for very specific areas).

like image 113
Yann Ramin Avatar answered Dec 08 '25 07:12

Yann Ramin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!