3
Optimizing Loops
Loops are fundamental programming constructs that are not terribly difficult to understand or write. We use them to iterate through our application’s data structures and perform repetitive tasks. We often take loops for granted based on their simple syntax and readability. When performance is a concern, loops have a duality. On one side, loops serve as a fundamental construct for efficient data processing. On the other side, poorly optimized loops can introduce significant bottlenecks and degrade the overall performance of our Java applications.
Concepts covered in this chapter include loop overhead, loop unrolling, benchmarks, loop fusion, loop parallelization, and loop vectorization. We will use code examples to provide ...
Get High Performance with Java now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.