Skip to content

Reduce compiler memory in context tool name mapping - #886

Merged
flip-engineer merged 1 commit into
mainfrom
codex/context-codec-compile-memory-20261018
Oct 18, 2026
Merged

flip-engineer merged 1 commit into
mainfrom
codex/context-codec-compile-memory-20261018

Conversation

@flip-engineer

Copy link
Copy Markdown
Collaborator

The three literal String patterns in tool_input_name produce a large checked term and increase compiler memory use. Use ordered String.eq checks and Bool.pick for the same three aliases and preserve unknown names unchanged.

The paired real-code probe on source d461a56 used the same Bend 2.0.25 compiler and five inputs. C generation fell from 54.61 to 34.09 seconds; peak RSS fell from 3,560,276 to 855,772 KiB. Both linked executables returned the same five output lines, exit 0 and empty stderr. This is a focused codec-entry result.

A matching check-only comparison on the recovery entry reduced validator-end heap from 3.403 to 2.558 GB and RSS from 6.808 to 5.180 GB. The candidate removed the observed roughly 340 MB retained-heap increase across tool_input_name. These measurements do not qualify the complete package.

Validation on the current-main parent bf4df22: the new compiled codec runtime test passed 1/1 in 33.228 seconds under an 8 GiB memory limit with swap disabled. It covers the three aliases, an already-normalized name and unknown-name passthrough.

Retained diagnostic log: /mnt/nvme4tb/ci-runners/baton2-native-homelab/retained/account-live-f25-20261018/hotspot-candidate-c/.scratch/hotspot-candidate-c.gcdiag.log, SHA256 714955c3fce8f59aedcea7523829a491771fae5ad94d5f244d3b516886cf753b.

Related: #776 for the general compiler lowering and retained-term investigation; #869 for the separate retained Codex-frame memory fix.

@flip-engineer
flip-engineer merged commit afe8640 into main Oct 18, 2026
@flip-engineer
flip-engineer deleted the codex/context-codec-compile-memory-20261018 branch October 18, 2026 23:02
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