If & else statements can be taxing for the CPU

Software ResiliencyProgramming Best Practices

Why you should care

If and else statements are considered to be time consuming in nature as they tend to be repetitive in order to execute the code properly which causes is not ideal for a programmer and can also be considered taxing for the CPU.

Business Impacts

While if and else statements are an essential component of the code, overusing them can be risky because it can slow down the code. This makes the code unproductive.

Production Risk

How we detect

This code insight’s rationale is that using unconditional if, and else, tends to greatly consume time as well as memory. It is recommended to review the source code and reduce the number of unconditional if and else-if statements.


About CAST and Highlight’s Code Insights

Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.

See featuresHow it works