Historical internal name "uncommonlisp" retired in favor of the
public name "lumbda" ahead of lumbda.com going live. Scope of
this commit:
Source files renamed:
uncommonlisp.py -> lumbda.py
asm/uncommonlisp.s -> asm/lumbda.s
c/uncommonlisp.h -> c/lumbda.h
whitepaper/uncommonlisp-whitepaper -> whitepaper/lumbda-whitepaper (.rst + .pdf)
Binaries renamed (tracked ones; c/ was always gitignored):
asm/uncommonlisp, asm/uncommonlisp-gc, asm/uncommonlisp.o,
asm/uncommonlisp-gc.o -> asm/lumbda(-gc)(.o)
c/.gitignore -> ignores lumbda
Internal string updates (sed pass ordered longest-first):
asm/uncommonlisp -> asm/lumbda
c/uncommonlisp -> c/lumbda
uncommonlisp.py -> lumbda.py
UNCOMMONLISP_BIN -> LUMBDA_BIN (asm/test.sh env var)
"uncommonlisp> " -> "lumbda> " (asm REPL prompt baked into binary)
UNCOMMONLISP -> LUMBDA (macros, comments)
uncommonlisp -> lumbda (prose)
Binary portal magic updated:
"ULPORTAL" -> "LUMBDAB1" # "Lumbda Binary v1"
Old portal files are not backward-compatible — this is a deliberate
break since it's the rename moment. S-expression portals already
carry their own ";; lumbda-portal v1" header and remain cleanly
versioned.
WHITEPAPER.pdf / WHITEPAPER.rst symlinks repointed to the renamed
files. Makefile's whitepaper target targets lumbda-whitepaper.pdf.
Not changed (intentional, separate phases):
- Filesystem directory /home/fox/git/uncommonlisp itself
(fox renames locally and the gitlab repo URL in a follow-up)
- tests.py hardcoded cwd=/home/fox/git/uncommonlisp
(matches the current on-disk location; will flip when the
directory rename ships)
- Git history (immutable; old commits still say uncommonlisp,
which is correct — that's what they were)
Verified:
137 asm no-GC + 137 asm GC + 571 Python + 83 C + 189 shared
functional tests all pass under the new names.
bench-gc-http (2000 req): all 4 cells behave as expected
(cells 1/2 flat, 3 leaks, 4 bounded at 1 chunk).
Python REPL, C REPL, asm REPL all start cleanly.
136 lines
4 KiB
Text
136 lines
4 KiB
Text
;;; bench-hashset.lsp — native hash-set vs portable vector-based ht-*
|
|
;;;
|
|
;;; ASM-ONLY: exercises the native hash-set-* primitives introduced
|
|
;;; alongside the portable-lib equivalent. C and Python tiers do not
|
|
;;; carry hash-set builtins (they have hash-table), so this file is
|
|
;;; driven from tests/bench-hashset.sh against asm/lumbda only.
|
|
;;;
|
|
;;; Phases: insert-N, hit-lookup-N, miss-lookup-N.
|
|
;;; Output: ms per phase + speedup (portable/native).
|
|
|
|
(define N 5000)
|
|
|
|
;;; ─── Portable hash-set (vectors + cons chains, pure Scheme) ───
|
|
;;; Identical algorithm to proof-netspace-server-lib.lsp.
|
|
|
|
(define *pht-buckets* 127)
|
|
|
|
(define (pht-make)
|
|
(let ((v (make-vector (+ *pht-buckets* 1) '())))
|
|
(vector-set! v 0 *pht-buckets*)
|
|
v))
|
|
|
|
(define (pht-bucket t k)
|
|
(+ 1 (modulo (if (< k 0) (- 0 k) k) (vector-ref t 0))))
|
|
|
|
(define (pht-in? bucket k)
|
|
(cond ((null? bucket) #f)
|
|
((= (car bucket) k) #t)
|
|
(else (pht-in? (cdr bucket) k))))
|
|
|
|
(define (pht-has? t k)
|
|
(pht-in? (vector-ref t (pht-bucket t k)) k))
|
|
|
|
(define (pht-add! t k)
|
|
(let ((idx (pht-bucket t k)))
|
|
(let ((bucket (vector-ref t idx)))
|
|
(if (pht-in? bucket k) #f
|
|
(begin (vector-set! t idx (cons k bucket)) #t)))))
|
|
|
|
;;; ─── Timing helpers ───
|
|
|
|
(define (ms-since t0) (- (current-time-ms) t0))
|
|
|
|
(define (report label ms)
|
|
(display label) (display ": ") (display ms) (display " ms") (newline))
|
|
|
|
;;; ─── Phase runners ───
|
|
|
|
(define (portable-insert! t n)
|
|
(define (loop i)
|
|
(if (>= i n) 'done
|
|
(begin (pht-add! t i) (loop (+ i 1)))))
|
|
(loop 0))
|
|
|
|
(define (portable-hit-lookups t n)
|
|
(define (loop i hits)
|
|
(if (>= i n) hits
|
|
(loop (+ i 1) (if (pht-has? t i) (+ hits 1) hits))))
|
|
(loop 0 0))
|
|
|
|
(define (portable-miss-lookups t n)
|
|
(define (loop i)
|
|
(if (>= i n) 'done
|
|
(begin (pht-has? t (+ i n)) (loop (+ i 1)))))
|
|
(loop 0))
|
|
|
|
(define (native-insert! s n)
|
|
(define (loop i)
|
|
(if (>= i n) 'done
|
|
(begin (hash-set-add! s i) (loop (+ i 1)))))
|
|
(loop 0))
|
|
|
|
(define (native-hit-lookups s n)
|
|
(define (loop i hits)
|
|
(if (>= i n) hits
|
|
(loop (+ i 1) (if (hash-set-contains? s i) (+ hits 1) hits))))
|
|
(loop 0 0))
|
|
|
|
(define (native-miss-lookups s n)
|
|
(define (loop i)
|
|
(if (>= i n) 'done
|
|
(begin (hash-set-contains? s (+ i n)) (loop (+ i 1)))))
|
|
(loop 0))
|
|
|
|
;;; ─── Driver ───
|
|
|
|
(display "=== hash-set benchmark N=") (display N) (display " ===") (newline)
|
|
|
|
(display "-- portable (vectors + cons chains, Scheme) --") (newline)
|
|
(define pt (pht-make))
|
|
(define t0 (current-time-ms))
|
|
(portable-insert! pt N)
|
|
(define p-ins (ms-since t0))
|
|
(report " insert" p-ins)
|
|
|
|
(set! t0 (current-time-ms))
|
|
(define p-hits (portable-hit-lookups pt N))
|
|
(define p-hit-ms (ms-since t0))
|
|
(report " hit-lookup" p-hit-ms)
|
|
(display " (hits=") (display p-hits) (display ")") (newline)
|
|
|
|
(set! t0 (current-time-ms))
|
|
(portable-miss-lookups pt N)
|
|
(define p-miss (ms-since t0))
|
|
(report " miss-lookup" p-miss)
|
|
|
|
(display "-- native (hash-set-*, bump-allocated in asm) --") (newline)
|
|
(define ns (make-hash-set))
|
|
(set! t0 (current-time-ms))
|
|
(native-insert! ns N)
|
|
(define n-ins (ms-since t0))
|
|
(report " insert" n-ins)
|
|
|
|
(set! t0 (current-time-ms))
|
|
(define n-hits (native-hit-lookups ns N))
|
|
(define n-hit-ms (ms-since t0))
|
|
(report " hit-lookup" n-hit-ms)
|
|
(display " (hits=") (display n-hits) (display ")") (newline)
|
|
|
|
(set! t0 (current-time-ms))
|
|
(native-miss-lookups ns N)
|
|
(define n-miss (ms-since t0))
|
|
(report " miss-lookup" n-miss)
|
|
|
|
(display "-- speedup (portable / native) --") (newline)
|
|
(define (speedup-x p n)
|
|
(if (= n 0) 'infinite (quotient (* 1000 p) n)))
|
|
(display " insert: ") (display (speedup-x p-ins n-ins))
|
|
(display " (milliX, so ")(display (quotient (speedup-x p-ins n-ins) 1000))
|
|
(display "x)") (newline)
|
|
(display " hit-lookup: ") (display (speedup-x p-hit-ms n-hit-ms))
|
|
(display " (milliX, so ")(display (quotient (speedup-x p-hit-ms n-hit-ms) 1000))
|
|
(display "x)") (newline)
|
|
(display " miss-lookup: ") (display (speedup-x p-miss n-miss))
|
|
(display " (milliX, so ")(display (quotient (speedup-x p-miss n-miss) 1000))
|
|
(display "x)") (newline)
|