lumbda/c
russell@unturf.com b8d6afdeb3 heap-snapshot + native HTTP client + MOAD-0001 cleanup
Three wins in one commit.

1) heap-snapshot / heap-restore (asm arena primitive)
   asm has no GC. Long-running servers leaked ~64 MB per heap growth.
   Two new builtins let a programmer capture r15 and later rewind to
   it, recycling intermediate allocations in O(1) memory.
   Python + C get no-op versions so portable .lsp code can call them
   unconditionally.

   examples/http-server.lsp now takes a snapshot at top level and
   rewinds after every request. Measured asm RSS: 88 KB initial,
   100 KB after 100 requests, 100 KB after 1100 requests — flat.
   Prior behavior was +64 MB per few thousand requests.

2) examples/http-client-bench.lsp — native HTTP load generator
   Uses only the six tcp-* primitives + current-time-ms. Runs
   identically in all three impls. Eliminates curl's ~2 ms/req
   fork+exec overhead, so real server throughput shows up:

     Python server ← Python client   2403 rps
     C      server ← C      client   2439 rps
     asm    server ← asm    client   2994 rps
     asm    server ← C      client   2500 rps

   The earlier curl-based bench was clamped near 400 rps by the
   client; the actual servers handle 6–7× that.

3) MOAD-0001 cleanup
   - c/builtins.c bi_string_replace: strncmp-at-every-position
     (hand-rolled, sedimentary) → strstr (libc-tuned, typically
     Boyer-Moore-Horspool). O(N*k) → O(N + matches*k).
   - uncommonlisp.py _tokenize_lines: per-token src.count('\n', 0, pos)
     → precompute line_starts once, bisect_right per token.
     O(N*M) → O(M + N log M).

Also adds current-time-ms to all three impls so benchmarks can
time themselves without relying on the Python/C float `current-time`
(asm has no floats). Seconds-since-epoch tagged as a 61-bit int.

Test counts unchanged: 571 py + 132 asm + 189 shared + 83 c = 975.
All green via make test-all.
2026-04-16 20:49:32 -04:00
..
.gitignore Add C implementation: 7,429 lines, 58 tests, identical output 2026-04-14 14:55:17 -04:00
bench.c JIT: add named-let loops, let/let*, and/or, car/cdr/cons, 18 new tests 2026-04-14 20:50:24 -04:00
builtins.c heap-snapshot + native HTTP client + MOAD-0001 cleanup 2026-04-16 20:49:32 -04:00
eval.c C: add deep_copy_env, VM frame stack for continuations 2026-04-15 19:57:17 -04:00
jit.c JIT: add named-let loops, let/let*, and/or, car/cdr/cons, 18 new tests 2026-04-14 20:50:24 -04:00
jit.h Add GPU architecture notes and JIT header 2026-04-14 19:43:16 -04:00
main.c x86_64 JIT: 12-21x faster than CPython, 230x faster than interpreter 2026-04-14 19:58:26 -04:00
Makefile C: add full continuations, portal save/resume, 7 new tests 2026-04-15 20:07:09 -04:00
portal.c C: add full continuations, portal save/resume, 7 new tests 2026-04-15 20:07:09 -04:00
printer.c Add C implementation: 7,429 lines, 58 tests, identical output 2026-04-14 14:55:17 -04:00
reader.c Add C implementation: 7,429 lines, 58 tests, identical output 2026-04-14 14:55:17 -04:00
test.c C: add full continuations, portal save/resume, 7 new tests 2026-04-15 20:07:09 -04:00
types.c C: add deep_copy_env, VM frame stack for continuations 2026-04-15 19:57:17 -04:00
uncommonlisp.h C: add full continuations, portal save/resume, 7 new tests 2026-04-15 20:07:09 -04:00
vm.c C: add full continuations, portal save/resume, 7 new tests 2026-04-15 20:07:09 -04:00