Skip to content

Interpreter: no result cache for natives, no trace text built per allocation - #1441

Merged
Frotty merged 3 commits into
masterfrom
claude/compiletime-function-perf-283503
Oct 12, 2026
Merged

Frotty merged 3 commits into
masterfrom
claude/compiletime-function-perf-283503

Conversation

@Frotty

@Frotty Frotty commented Oct 12, 2026

Copy link
Copy Markdown
Member

Two costs of the compile-time interpreter which bought nothing:

  • ProgramState.allocate built its trace message on every allocation, which prints the allocating constructor or closure, although trace logging is off. It is built only when tracing is on now. This was about 22 % of the samples in the compile-time phase of gods-arena.
  • The interpreter memoised the results of natives it considers pure. They are cheaper than hashing and comparing their arguments, and once a native had 2048 results every call removed one entry. The cache was cleared after each compilation, so a warm language server gained nothing either. The natives whose handle identity matters keep their own handles (the conversions, Player), so the cache is removed with its statistics and clearInterpreterCaches.

Compile-time functions of gods-arena (Jass, median of 3 alternating cold builds): 2103 ms before, 1791 ms with the first change, 1546 ms with both. Warm JVM (one process, 12 alternating builds): about 1156 ms with the cache, 850 ms without. The Jass output is identical in every run.

No behaviour changes, so no new test; CompiletimeTests, CompiletimeNativesTest, CompiletimeHashtableTests, InterpreterTests, ModelManagerTests, OptimizerTests and StdLibStringTests pass.

…ocation

ProgramState.allocate built its trace message on every allocation, which
prints the allocating constructor or closure, although trace logging is
off. It is built only when tracing is on now.

The interpreter memoised the results of natives it considers pure. The
natives are cheaper than hashing and comparing their arguments, and the
eviction removed one entry per call once a native had 2048 results. The
natives whose handle identity matters keep their own handles (the
conversions, Player), so the cache is removed.

On gods-arena the compile-time functions ran in 2103 ms before, 1791 ms
with the first change and 1546 ms with both (median of 3 cold builds);
on a warm JVM the cache made no gain either. Output identical.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 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-12T16:21:29.465622Z dd405ae Manual request
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6011e7825

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Frotty

Frotty commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: dd405aef5d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Frotty
Frotty merged commit 647c63a into master Oct 12, 2026
3 checks passed
@Frotty
Frotty deleted the claude/compiletime-function-perf-283503 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