Skip to content

refactor(codegen): migrate class-allocator to typeof() (phase-e step 5, pr1)#576

Merged
cs01 merged 1 commit intomainfrom
refactor/typed-ast-class-alloc
Apr 20, 2026
Merged

refactor(codegen): migrate class-allocator to typeof() (phase-e step 5, pr1)#576
cs01 merged 1 commit intomainfrom
refactor/typed-ast-class-alloc

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Apr 20, 2026

Summary

  • Swaps ctx.resolveExpressionType(stmt.value) for ctx.typeOf(stmt.value) in the class-allocator ternary branch.
  • Routes through the pre-populated annotator cache first, falling through to the memoized resolver only for expression shapes the annotator skipped.

User impact

  • No behavior change. Slightly faster class allocation on ternary initializers that the annotator already typed.

Test plan

  • npm run verify (full, stage 2 included) green locally.

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark Results (Linux x86-64)

Benchmark C ChadScript Go Node Place
Cold Start 0.8ms 0.6ms 1.0ms 27.0ms 🥇
Fibonacci 0.725s 0.722s 1.434s 2.842s 🥇
Hash Map Lookup 0.112s 0.064s 0.103s 0.153s 🥇
Matrix Multiply 0.436s 0.406s 0.453s 0.456s 🥇
Monte Carlo Pi 0.400s 0.381s 0.406s 1.474s 🥇
Regex Match 0.013s 0.004s 0.020s 0.005s 🥇
JSON Parse/Stringify 0.032s 0.044s 0.172s 0.134s 🥈
N-Body Simulation 1.434s 1.852s 1.948s 2.298s 🥈
SQLite 0.048s 0.334s 0.469s 0.448s 🥈
Sieve of Eratosthenes 0.031s 0.042s 0.043s 0.057s 🥈
Binary Trees 1.355s 1.400s 2.924s 1.318s 🥉
File I/O 0.071s 0.073s 0.072s 0.231s 🥉
Quicksort 0.170s 0.216s 0.183s 0.248s 🥉
String Manipulation 0.008s 0.017s 0.016s 0.035s 🥉

CLI Tool Benchmarks

Benchmark ChadScript grep node xxd Place
Hex Dump 0.477s 1.042s 0.070s 🥈
Recursive Grep 0.013s 0.008s 0.103s 🥈

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