Update whitepaper: 4 implementations, assembly benchmarks, JIT results

Section 11: Four Implementations, One Language — performance table
across Python, C, C+JIT, and Assembly. Hand-written asm is 2.5-4x
faster than gcc -O2 on recursive workloads. JIT is 33x faster than asm.

Section 11.1: Test Coverage — 836 verified assertions across all impls.
Section 12: Future Work — GPU lambda execution roadmap added.

"A diagram is worth 10,000 words." — russell@unturf.com
This commit is contained in:
russell@unturf.com 2026-04-15 14:10:13 -04:00
parent 670487c01d
commit 87db0b0841
2 changed files with 751 additions and 223 deletions

File diff suppressed because one or more lines are too long

View file

@ -547,13 +547,53 @@ uncommonlisp forms one piece of a larger permacomputer machine learning stack:
uncommonlisp provides the runtime layer: a language that can checkpoint its own execution, migrate between machines, & resume from serialized state. The portal system enables distributed computation across permacomputer nodes. Categorization & feedback activities could run inside uncommonlisp's VM, with ``call/cc`` providing the state machine transitions & portal providing persistence.
11. Future Work
11. Four Implementations, One Language
---------------------------------------
*"A diagram is worth 10,000 words."* — russell@unturf.com
uncommonlisp exists as four implementations sharing the same ``.lsp`` test files:
.. table::
:widths: 25 10 12 12 12 12
===================== ======= ========== =========== ============ ==============
Implementation Lines ack(3,4) sum-to(50k) Binary Dependencies
===================== ======= ========== =========== ============ ==============
Python bytecode VM 3,324 93ms 515ms interpreted Python 3
C tree-walker 8,120 29ms 105ms 171KB libc
C + x86_64 JIT 9,429 0.2ms 0.35ms 171KB libc
x86_64 Assembly 2,592 7.3ms 43ms 13KB none
===================== ======= ========== =========== ============ ==============
Assembly times include process startup and parsing.
**The JIT compiles Scheme to native machine code at runtime** via ``mmap(PROT_EXEC)`` & raw x86_64 byte emission. It handles ``if``, ``cond``, ``and``, ``or``, ``let``, named-let loops, ``car``/``cdr``/``cons``, arithmetic, comparisons, & self-recursive calls. Functions that use ``call/cc``, macros, or complex forms fall back to the interpreter.
**The assembly implementation proves the language is substrate-independent.** 2,592 lines of GNU assembler, 13KB stripped binary, zero external dependencies. It uses only four Linux syscalls (``read``, ``write``, ``mmap``, ``exit``), a bump allocator, & tag-in-low-3-bits values. It runs ``(ack 3 4) = 125`` & ``(fib 35) = 9227465`` correctly, 2.5--4x faster than the C interpreter on recursive workloads.
**Key finding**: Hand-written assembly outperforms ``gcc -O2`` on the same algorithm because it avoids C's function call overhead for eval dispatch. But the JIT outperforms everything: 33x faster than hand-written assembly, because it eliminates the interpreter loop entirely.
11.1 Test Coverage
^^^^^^^^^^^^^^^^^^^^
836 verified assertions across all implementations:
- Python: 571 unit + integration tests (``tests.py``)
- C: 76 unit + integration + JIT tests (``c/test.c``)
- Assembly: 75 unit + integration + functional tests (``asm/test.sh``)
- Shared: 114 functional tests (``tests/functional.lsp``, runs in Python & C)
All pass via ``make test-all``.
12. Future Work
----------------
- **Complex number arithmetic**: Extending uncommonlisp's numeric tower to support complex numbers natively, enabling the full EML derivation chain to execute within the VM
- **GPU lambda execution**: Map/reduce on CUDA for data-parallel Scheme (Phase 1), trampolining for recursive lambdas (Phase 2), interaction combinators for massive parallelism (Phase 3)
- **Distributed continuation passing**: Portal files served over HTTP, enabling a network of permacomputer nodes to pass continuations as messages
- **JIT compilation**: Translating hot bytecode sequences to Python bytecode or native code via ctypes
- **Activity VM**: Running categorization-and-feedback YAML activities directly in uncommonlisp, with ``call/cc`` replacing the explicit state machine
- **Complex number arithmetic**: Extending the numeric tower for the full EML derivation chain
- **Activity VM**: Running categorization-and-feedback YAML activities directly in uncommonlisp
Citation