Skip to content

refactor(codegen): drop redundant resolveExpressionType fallback in variable-allocator#592

Merged
cs01 merged 1 commit intomainfrom
refactor/typeof-var-alloc
Apr 20, 2026
Merged

refactor(codegen): drop redundant resolveExpressionType fallback in variable-allocator#592
cs01 merged 1 commit intomainfrom
refactor/typeof-var-alloc

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Apr 20, 2026

Summary

  • Removes a dead fallback in variable-allocator.ts:745-748 where typeOf() returning null was followed by a second call to resolveExpressionType(). That second call was always null too, because typeOf already wraps resolveExpressionTypeRich, which wraps the base resolveExpressionType — if the base is null, rich is null, so typeOf is null.
  • Drops resolveExpressionType from the VariableAllocatorContext interface entirely — last consumer removed, API surface shrinks.

User-facing effect

  • No behavior change. One less redundant resolver call per variable declaration.
  • Tightens the Phase-E convergence: VariableAllocatorContext is now strictly a typeOf-only consumer, so future callers can't accidentally bypass the annotator cache.

Test plan

  • npm run verify — full tests + 3-stage self-host green locally
  • CI green

…ariable-allocator — typeof already wraps rich resolver (phase-e step 5)
@github-actions
Copy link
Copy Markdown
Contributor

Benchmark Results (Linux x86-64)

Benchmark C ChadScript Go Node Place
Cold Start 1.0ms 0.8ms 1.2ms 26.5ms 🥇
Fibonacci 0.819s 0.765s 1.560s 3.192s 🥇
Hash Map Lookup 0.093s 0.063s 0.090s 0.112s 🥇
Binary Trees 1.391s 1.272s 2.705s 1.187s 🥈
File I/O 0.117s 0.092s 0.087s 0.204s 🥈
JSON Parse/Stringify 0.035s 0.052s 0.177s 0.137s 🥈
N-Body Simulation 1.671s 2.123s 2.221s 2.409s 🥈
Regex Match 0.016s 0.005s 0.021s 0.004s 🥈
SQLite 0.052s 0.379s 0.489s 0.413s 🥈
Monte Carlo Pi 0.389s 0.410s 0.404s 2.248s 🥉
Quicksort 0.214s 0.246s 0.213s 0.262s 🥉
Sieve of Eratosthenes 0.015s 0.028s 0.020s 0.039s 🥉
String Manipulation 0.008s 0.017s 0.016s 0.037s 🥉
Matrix Multiply 0.470s 1.005s 0.566s 0.361s #4

CLI Tool Benchmarks

Benchmark ChadScript grep node xxd Place
Hex Dump 0.556s 1.029s 0.133s 🥈
Recursive Grep 0.019s 0.009s 0.102s 🥈

@cs01 cs01 merged commit 0f8e9a2 into main Apr 20, 2026
13 checks passed
@cs01 cs01 deleted the refactor/typeof-var-alloc branch April 20, 2026 16:54
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