mirror of
https://github.com/morluto/rea.git
synced 2026-10-27 01:45:32 +00:00
perf(environment): intersect list identity candidates through a set
The list planner filtered each recording's candidate fields with a linear includes per candidate, even on the first recording, so a one-item list with tens of thousands of suffix-named fields cost hundreds of millions of comparisons. The first recording's candidates now stand as they are and later recordings intersect through a set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ef49dca6d7
commit
b4b7ebc787
1 file changed
+7
-3
@@ -347,9 +347,13 @@ export class EnvironmentStateExtraction {
|
||||
return;
|
||||
}
|
||||
if (found === true) continue;
|
||||
names = (names ?? found.fields).filter((name) =>
|
||||
found.fields.includes(name),
|
||||
);
|
||||
// The first recording's candidates stand; later ones intersect through a set, so a wide
|
||||
// item costs one pass per recording.
|
||||
if (names === undefined) names = found.fields;
|
||||
else {
|
||||
const matching = new Set(found.fields);
|
||||
names = names.filter((name) => matching.has(name));
|
||||
}
|
||||
if (found.several) for (const name of found.fields) shown.add(name);
|
||||
}
|
||||
// An identity name is only inferred from items that carry it; empty lists prove none.
|
||||
|
||||
Reference in new issue
Block a user