Skip to content

Commit 680e96a

Browse files
author
MesTTo
committed
docs(bench): scope Lever B (flat interned core) against the real MORK encoding
1 parent 5a41ae9 commit 680e96a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

packages/node/bench/RESULTS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,10 @@ Method: `node --prof` to find hot spots, research the V8/interpreter technique,
2525

2626
Net: the full oracle went from ~62 ms to ~39 ms (~37% faster) and `fib(15)` from ~26.6 ms to ~17.4 ms (~35% faster), correctness unchanged at 270/270.
2727

28-
The deeper Phase-15 levers (staging/partial-evaluation, a MORK-style flat interned atom core, a bytecode VM, a `mnemonist` AtomSpace index) remain as the next round, same profile→research→measure→gate loop.
28+
5. **Interpreter stack as a cons-list**`Stack` is an immutable `{head, tail}` cons-list, so per-step push/rest are O(1) instead of array `slice(1)`/spread (which the profile flagged as `ArrayPrototypeSlice`). Helps deep recursion most.
29+
30+
## The next major lever (scoped against the real MORK code)
31+
32+
The biggest remaining lever is **Lever B: a flat, interned atom core**, modeled on MORK's actual representation (`/home/user/Dev/mork-latest-linalg/kernel`, `mork::__mork_expr`): expressions encoded as a contiguous byte/int sequence with `Arity(n)` / `SymbolSize(k)+bytes` / `NewVar` / `VarRef(i)` tags, symbols interned to ids, stored in a PathMap radix trie. The payoff is large — `atomEq` becomes a byte compare, traversal is a cache-friendly linear scan, allocation collapses, and `getTypes`/match results become memoizable by id. The current profile's top costs (`mettaEval` allocation, `getTypes`, Map lookups) are exactly what it targets.
33+
34+
This is **not** a contained change: it rewrites the atom model and everything built on it (parser output, matcher, evaluator), so it is a follow-on project gated by the 270/270 oracle and a before/after benchmark, not a single-session edit — done prematurely it would destabilize the verified core. The six optimizations above are the contained wins; Lever B (and a staging/partial-evaluation backend, and a `mnemonist` AtomSpace index) are the scoped next round, with MORK's code as the concrete reference.

0 commit comments

Comments
 (0)