Skip to content

perf(eval): normalize by evaluation instead of substitution - #4

Merged
yazaldefilimone merged 1 commit into
mainfrom
perf/nbe
Oct 18, 2026
Merged

yazaldefilimone merged 1 commit into
mainfrom
perf/nbe

Conversation

@yazaldefilimone

Copy link
Copy Markdown
Owner

Evaluate terms into a flat semantic domain of closures, neutrals and thunks, then read the value back once, instead of rebuilding the term at every beta step. Weak-head (lazy) and trace runs stay on the spine normalizer. Output is identical corpus-wide; arena allocations drop ~98% and heavy programs normalize up to ~20x faster.

Evaluate terms into a flat semantic domain of closures, neutrals and
thunks, then read the value back once, instead of rebuilding the term at
every beta step. Weak-head (`lazy`) and `trace` runs stay on the spine
normalizer. Output is identical corpus-wide; arena allocations drop ~98%
and heavy programs normalize up to ~20x faster.
@github-actions

Copy link
Copy Markdown

Benchmark for dd169f9

Click to view benchmark
Test Base PR %
eval/arithmetic 3.5±0.07µs 1125.7±32.23ns -67.84%
eval/booleans 1546.8±23.26ns 671.1±15.34ns -56.61%
eval/deep 7.2±0.08µs 2.7±0.06µs -62.50%
eval/factorial 427.1±4.86µs 14.8±0.48µs -96.53%
eval/pred 6.2±0.11µs 1122.1±24.17ns -81.90%
eval/skk 1222.8±47.94ns 628.2±18.93ns -48.63%
lex/arithmetic 1816.4±29.41ns 1821.9±57.97ns +0.30%
lex/deep 1083.5±22.62ns 1014.4±15.10ns -6.38%
lex/factorial 3.0±0.05µs 3.4±0.16µs +13.33%
lex/list 2.7±0.09µs 2.7±0.04µs 0.00%
lex/pred 1927.7±30.41ns 1914.1±52.85ns -0.71%
parse/arithmetic 1593.0±19.04ns 1805.2±40.14ns +13.32%
parse/deep 967.9±14.61ns 1065.1±7.86ns +10.04%
parse/factorial 2.6±0.05µs 2.7±0.04µs +3.85%
parse/list 1965.2±18.08ns 2.1±0.04µs +6.86%
parse/pred 1987.8±17.80ns 1927.8±40.33ns -3.02%

@yazaldefilimone
yazaldefilimone merged commit ac2ce9a into main Oct 18, 2026
3 checks passed
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