Skip to content

Avoid repeated member lookup during dispatch translation - #1468

Merged
Frotty merged 2 commits into
masterfrom
codex/backlog-followup
Oct 16, 2026
Merged

Frotty merged 2 commits into
masterfrom
codex/backlog-followup

Conversation

@Frotty

@Frotty Frotty commented Oct 16, 2026

Copy link
Copy Markdown
Member

Dispatch translation already knows the method declaration, but getClassesWithImplementation searched for it again through general member lookup for every subclass. That lookup adapts unrelated overloads and searches enclosing scopes. Create the known declaration's link once, bind its receiver to each subclass with the existing matching routine, and retain the existing most-specific implementation selection. Empty receiver sets return immediately.

On current Castle Fight sources, an oracle compared the ordered class-to-implementation results with the original algorithm for all 12,489 calls on each target, with no differences. A separate alternating run in one JVM, without concurrent builds, measured Lua AST-to-IM translation at a median 641 ms before versus 477 ms after (four pairs after discarding the first warm-up pair, about 26% lower). This is a translation-phase measurement, not an end-to-end build-time claim. Production code has no net line growth.

Validation: 703 focused tests passed with no skips across dispatch implementation, classes, interfaces, modules, both generic systems, determinism, Lua emission, closures, field iteration and language features. The new tests cover generic receiver binding, inherited versus overridden implementations, and execution of generic overloads on both targets. git diff --check passed. Checks ran on Windows; Linux/macOS and the actual game remain unverified.

Also records why the closed class-pruning PR #1457 and the discarded conservative prototype should not be revisited without new evidence, and removes the addressed translation lookup item from the backlog. A combined module/generic-overload fixture exposed a separate Lua root-slot failure on unmodified master; its reproduction is recorded as follow-up work in BACKLOG.md.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T10:14:34.850028Z c0ee2ce PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Frotty
Frotty merged commit 92701f3 into master Oct 16, 2026
2 checks passed
@Frotty
Frotty deleted the codex/backlog-followup branch November 25, 2026 08:53
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