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 <noreply@anthropic.com>
This commit is contained in:
MarekZegare4
2026-06-24 17:01:55 +02:00
parent a67bf9e220
commit fee2d32bd3

View File

@@ -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);