Nested Loops cause performance issues

[nz_btn text="Software Elegance" link="http://casthighlight.wpengine.com/category/product/indicators-methodology/software-elegance" target="_self" animate="false" animation_type="ghost" color="black" size="small" shape="rounded" type="normal" hover_normal="fill" hover_ghost="fill" icon="icon-dashboard"][nz_btn text="Code Complexity" target="_self" animate="false" animation_type="ghost" color="black" size="small" shape="rounded" type="ghost" hover_normal="fill" hover_ghost="screen" link="http://casthighlight.wpengine.com/category/product/indicators-methodology/software-elegance/code-complexity/" icon="icon-code"]

Why you should care

If the amount of data is large, nested loops are fully avoided due to performance issues. If the program is extracting small amount of data, then focus on SELECT statements than nested loops. The indexed loop and READ statement using binary search are the best methods to avoid performance issues.

Business Impacts

Nested Loops can greatly reduce the innovative potential of the code because it negatively impacts performance. [nz_btn text="Acceleration" target="_self" animate="false" animation_type="ghost" color="orange" size="small" shape="rounded" type="normal" hover_normal="opacity" hover_ghost="fill" link="http://casthighlight.wpengine.com/category/product/indicators-methodology/acceleration/" icon="icon-office"]

CAST Recommendations

Reduce the total number of parameters by subdividing your functions into more specialized and granular artifacts.

References

http://www.sommarskog.se/share_data.html[nz_btn text="Style Guide" link="https://github.com/Kristories/awesome-guidelines" target="_self" icon="icon-book" animate="false" animation_type="ghost" color="turquoise" size="small" shape="rounded" type="ghost" hover_normal="fill" hover_ghost="screen"]

How we detect

This code insight checks all Abap artifacts containing nested loops. These are: – LOOP … ENDLOOP – DO … ENDDO – WHILE … ENDWHILE – PROVIDE … ENDPROVIDE

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.
[nz_btn text="See features" link="http://casthighlight.wpengine.com/outputs-analytics/" target="_self" icon="icon-stats" animate="false" animation_type="ghost" color="black" size="small" shape="rounded" type="normal" hover_normal="fill" hover_ghost="fill"][nz_btn text="How it works" link="http://casthighlight.wpengine.com/how-it-works/" target="_self" icon="icon-cog" animate="false" animation_type="ghost" color="black" size="small" shape="rounded" type="ghost" hover_normal="fill" hover_ghost="fill"]
For reference only. For the complete details please refer the original article
https://doc.casthighlight.com/alt_nestedloop-nested-loops-cause-performance-issues/
Have more questions? Submit a request

Comments

Powered by Zendesk