Skip to content

perf(registry): resolve embedded operators from a per-family manifest… - #106

Open
dotsimulate wants to merge 1 commit into
mainfrom
perf/manifest-index-operator-resolution
Open

dotsimulate wants to merge 1 commit into
mainfrom
perf/manifest-index-operator-resolution

Conversation

@dotsimulate

Copy link
Copy Markdown
Owner

… index

GetMasterOps() calls get_operator_source() once per operator, and each call falls back to a deep manifest scan that parses every manifest's OpInfo JSON, so one fam_create cook costs O(masters^2) JSON parses.

The fast tag lookup never hits: it queries maxDepth=1, but _tag_op() writes /FAM:/TYPE: onto each master's FamManifest child at depth 2. Depth alone is not the fix - findChildren(allTags) defaults to False, so a deeper query would OR-match every manifest and resolve every lookup to the same master, and TYPE: tags keep their case while lookups are lowercased.

Replaces the tag query and the deep scan with one indexed pass per family ({op_type_lower: [master, ...]}), invalidated at the top of GetMasterOps so it is built once per call and reused by every lookup inside it. The name-based fallback is unchanged.

TouchDesigner 2025.32820, 133 masters:

GetMasterOps json.loads 18,088 -> 532
GetMasterOps ~89ms -> ~3.7ms
fam_create cook ~97ms -> ~6.5ms
menu view switch 96-101ms -> 7-9ms

GetMasterOps returns 133 rows before and after with an identical fingerprint (op_name, op_version, op_label per op_type): 0 missing, 0 added, 0 changed.

… index

GetMasterOps() calls get_operator_source() once per operator, and each call
falls back to a deep manifest scan that parses every manifest's OpInfo JSON,
so one fam_create cook costs O(masters^2) JSON parses.

The fast tag lookup never hits: it queries maxDepth=1, but _tag_op() writes
<MANIFEST>/<FAM:>/<TYPE:> onto each master's FamManifest child at depth 2.
Depth alone is not the fix - findChildren(allTags) defaults to False, so a
deeper query would OR-match every manifest and resolve every lookup to the
same master, and <TYPE:> tags keep their case while lookups are lowercased.

Replaces the tag query and the deep scan with one indexed pass per family
({op_type_lower: [master, ...]}), invalidated at the top of GetMasterOps so
it is built once per call and reused by every lookup inside it. The
name-based fallback is unchanged.

TouchDesigner 2025.32820, 133 masters:

  GetMasterOps json.loads  18,088 -> 532
  GetMasterOps              ~89ms -> ~3.7ms
  fam_create cook           ~97ms -> ~6.5ms
  menu view switch       96-101ms -> 7-9ms

GetMasterOps returns 133 rows before and after with an identical fingerprint
(op_name, op_version, op_label per op_type): 0 missing, 0 added, 0 changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant