Skip to content

typing/perf 2/4: QW1+QW2 hygiene — in-place single-MATCH check, fewer clones - #81

Open
Felipe705x wants to merge 1 commit into
tc-perf/01-instrumentationfrom
tc-perf/02-hygiene
Open

typing/perf 2/4: QW1+QW2 hygiene — in-place single-MATCH check, fewer clones#81
Felipe705x wants to merge 1 commit into
tc-perf/01-instrumentationfrom
tc-perf/02-hygiene

Conversation

@Felipe705x

Copy link
Copy Markdown
Collaborator

Stacked on #80.

  • check_query: single non-optional MATCH checked in place (skips the collapsed_pattern() AST deep-clone; multi-match unchanged).
  • TypeEnvironment::keys() → iterator; new iter()/set_shared() so env merges share Rc bindings instead of deep-cloning descriptor trees.
  • warn_for_collapsed_bindings iterates bindings directly (no key Vec, no double lookups).
  • check_subquery_body: one up-front env clone instead of two.

Measured effect: within noise on every category (chain_16 448 → 436 µs, subq_exists 69.1 → 68.4 µs). Claimed as hygiene, not a win — kept because risk-free and it cleans the hot path for the following PRs.

🤖 Generated with Claude Code

…ones

- check_query: a single non-optional MATCH is checked in place instead
  of through collapsed_pattern(), which for one match is exactly "deep-
  clone the whole pattern AST". Multi-match keeps the Join collapse.
- TypeEnvironment::keys() returns an iterator (no Vec per call); new
  iter()/set_shared() let env merges share Rc bindings instead of
  deep-cloning descriptor trees (the Filter ambient merge did one deep
  clone per binding).
- warn_for_collapsed_bindings iterates bindings directly (no key Vec,
  no double hash lookups).
- check_subquery_body seeds its fold from the outer env directly —
  one up-front clone (the ambient push) instead of two per subquery.

Measured effect (pattern_typecheck, LDBC SF0.1 schema): within noise
on every category (chain_16 448 → 436 us, subq_exists 69.1 → 68.4 us)
— claimed as hygiene, not as a win. The schema-scan term dominates;
that is QW3/QW4 territory.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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