Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do extra parentheses have an impact on performance?

Tags:

c

I have a program in C, that uses lots of mathematical calculations, At some places during calculation the expression has many redundant parenthesis and braces

eg: ((x*y)+(((z*c))))

Does It degrade the performance ? Should we avoid it?

like image 733
Ritesh kumar Avatar asked Dec 14 '25 12:12

Ritesh kumar


1 Answers

No, this shouldn't affect execution time since the expression will be simplified by the compiler.

It might have a minute effect on compilation time but note that word "minute" - it's doubtful you'd even notice.

Far more of an effect would be any developer reading that code. The superfluous parentheses may make it harder to understand or it may delay them a little while they curse the coder that inflicted such rubbish on them :-)

like image 128
paxdiablo Avatar answered Dec 19 '25 07:12

paxdiablo



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!