Tag

nested-loop

0 views collected around this technical thread.

macrozheng
macrozheng
Mar 11, 2025 · Backend Development

Boost Java Loop Performance: Replace Nested Loops with Map Lookups

This article demonstrates how to dramatically speed up Java data‑matching operations that use nested for‑loops by breaking early when a match is found and by converting the inner list into a HashMap for O(1) lookups, showing code examples, performance measurements, and practical tips for backend developers.

HashMapJavaOptimization
0 likes · 7 min read
Boost Java Loop Performance: Replace Nested Loops with Map Lookups
Java Tech Enthusiast
Java Tech Enthusiast
Feb 1, 2025 · Backend Development

Optimizing Nested Loops in Java with Map and Break

To avoid the O(n × m) cost of naïve nested loops when matching IDs, replace the inner scan with a break after a unique match or, far more efficiently, build a HashMap of the secondary list so each lookup becomes O(1), dropping overall complexity to O(n + m) and cutting execution time from tens of seconds to a few hundred milliseconds.

HashMapJavaOptimization
0 likes · 8 min read
Optimizing Nested Loops in Java with Map and Break
Top Architect
Top Architect
Dec 20, 2024 · Backend Development

Optimizing Nested Loops in Java Using Map for Faster ID Matching

This article demonstrates how to replace inefficient nested for‑loops that match user IDs between two large lists with a map‑based lookup, showing code examples, performance measurements, and the impact of using break statements and O(1) hash map access to dramatically reduce execution time.

BackendJavaOptimization
0 likes · 9 min read
Optimizing Nested Loops in Java Using Map for Faster ID Matching
Java Captain
Java Captain
Nov 19, 2024 · Backend Development

Optimizing Nested Loop Data Matching with a Map in Java

This article demonstrates how replacing a costly nested‑loop search for matching user IDs with a pre‑built HashMap dramatically reduces processing time from tens of seconds to a few seconds, explaining the underlying time‑complexity benefits and providing complete Java code examples.

CollectionsHashMapJava
0 likes · 6 min read
Optimizing Nested Loop Data Matching with a Map in Java
Selected Java Interview Questions
Selected Java Interview Questions
Mar 8, 2024 · Backend Development

Optimizing Nested Loops in Java: Using break and HashMap for Significant Performance Gains

This article analyzes a common Java scenario of nested for‑loops over large user and user‑memo lists, demonstrates the performance impact of adding a break statement, and shows how converting the inner list to a HashMap can reduce execution time from tens of seconds to a few seconds.

BackendHashMapJava
0 likes · 9 min read
Optimizing Nested Loops in Java: Using break and HashMap for Significant Performance Gains
Aikesheng Open Source Community
Aikesheng Open Source Community
Feb 29, 2024 · Databases

Optimizing Nested-Loop Join Performance in OceanBase: Analysis, Rewrites, and Results

This article analyzes a slow Join query on OceanBase 3.2.3.3, examines execution plans and table statistics, proposes two rewrite methods—adding a filter condition and using a hash‑join hint—and demonstrates how these changes reduce execution time from over 500 seconds to just a few seconds.

Join OptimizationOceanBaseSQL
0 likes · 12 min read
Optimizing Nested-Loop Join Performance in OceanBase: Analysis, Rewrites, and Results
360 Zhihui Cloud Developer
360 Zhihui Cloud Developer
Jul 4, 2019 · Databases

Mastering SQL Joins: How Optimizers Choose the Best Access Path

This article explains how SQL optimizers choose join methods and table order, compares nested loop and merge joins, outlines factors influencing table selection, and offers practical guidance for improving multi‑table query performance.

Join OptimizationMerge JoinQuery Planner
0 likes · 8 min read
Mastering SQL Joins: How Optimizers Choose the Best Access Path