From fee2d32bd3fc641e2b39f8272dee4d57f9a4096e Mon Sep 17 00:00:00 2001 From: MarekZegare4 Date: Wed, 24 Jun 2026 17:01:55 +0200 Subject: [PATCH] perf(companion): stop Locator target scan once TARGET_MAX is reached buildTargets() kept iterating every contact after _targets filled up, doing a lookup + dedup pass per row with no effect (addPersonTarget already caps at TARGET_MAX). Bound the loop instead. Co-Authored-By: Claude Opus 4.8 --- examples/companion_radio/ui-new/LocatorScreen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/companion_radio/ui-new/LocatorScreen.h b/examples/companion_radio/ui-new/LocatorScreen.h index 5b1b537a..ddec2ed9 100644 --- a/examples/companion_radio/ui-new/LocatorScreen.h +++ b/examples/companion_radio/ui-new/LocatorScreen.h @@ -193,7 +193,7 @@ public: if (!c) continue; addPersonTarget(pre, c->name, /*require_position=*/false); } - for (int idx = 0; ; idx++) { + for (int idx = 0; _target_n < TARGET_MAX; idx++) { ContactInfo c; if (!the_mesh.getContactByIdx(idx, c)) break; addPersonTarget(c.id.pub_key, c.name, /*require_position=*/true);