jart / sectorlisp

Bootstrapping LISP in a Boot Sector
ISC License
1.29k stars 56 forks source link

What's the runtime memory footprint of SectorLisp? #25

Closed shafqatevo closed 2 years ago

shafqatevo commented 2 years ago

Hi @jart , jaw-dropping work!

What's the typical runtime memory footprint when it is loaded?

jart commented 2 years ago

Thanks! The only runtime overhead for the i8086 version is the 512 bytes that needs to be loaded for the program itself. As for the version that's written in C, if I run rusage.com ./lisp and run John McCarthy's metacircular evaluator in it, then here's the x86-64 resource usage report:

main jart@nightmare:~/code/sectorlisp-main$ rusage.com ./lisp
* ((LAMBDA (ASSOC EVCON PAIRLIS EVLIS APPLY EVAL) (EVAL (QUOTE ((LAMBDA (FF X) (FF X)) (QUOTE (LAMBDA (X) (COND ((ATOM X) X) ((QUOTE T) (FF (CAR X)))))) (QUOTE ((A) B C)))) ())) (QUOTE (LAMBDA (X Y) (COND ((EQ Y
)) ()) ((EQ X (CAR (CAR Y))) (CDR (CAR Y))) ((QUOTE T) (ASSOC X (CDR Y)))))) (QUOTE (LAMBDA (C A) (COND ((EVAL (CAR (CAR C)) A) (EVAL (CAR (CDR (CAR C))) A)) ((QUOTE T) (EVCON (CDR C) A))))) (QUOTE (LAMBDA (X Y A
 (COND ((EQ X ()) A) ((QUOTE T) (CONS (CONS (CAR X) (CAR Y)) (PAIRLIS (CDR X) (CDR Y) A)))))) (QUOTE (LAMBDA (M A) (COND ((EQ M ()) ()) ((QUOTE T) (CONS (EVAL (CAR M) A) (EVLIS (CDR M) A)))))) (QUOTE (LAMBDA (FN
 A) (COND ((ATOM FN) (COND ((EQ FN (QUOTE CAR)) (CAR (CAR X))) ((EQ FN (QUOTE CDR)) (CDR (CAR X))) ((EQ FN (QUOTE ATOM)) (ATOM (CAR X))) ((EQ FN (QUOTE CONS)) (CONS (CAR X) (CAR (CDR X)))) ((EQ FN (QUOTE EQ)) (EQ
(CAR X) (CAR (CDR X)))) ((QUOTE T) (APPLY (EVAL FN A) X A)))) ((EQ (CAR FN) (QUOTE LAMBDA)) (EVAL (CAR (CDR (CDR FN))) (PAIRLIS (CAR (CDR FN)) X A)))))) (QUOTE (LAMBDA (E A) (COND ((ATOM E) (ASSOC E A)) ((ATOM (C
R E)) (COND ((EQ (CAR E) (QUOTE QUOTE)) (CAR (CDR E))) ((EQ (CAR E) (QUOTE COND)) (EVCON (CDR E) A)) ((QUOTE T) (APPLY (CAR E) (EVLIS (CDR E) A) A)))) ((QUOTE T) (APPLY (CAR E) (EVLIS (CDR E) A) A))))))
A
* RL: took 9,376,918µs wall time
RL: ballooned to 652kb in size
RL: needed 19,443µs cpu (33% kernel)
RL: caused 349 page faults (100% memcpy)
RL: 203 context switches (99% consensual)
RL: performed 0 reads and 32 write i/o operations
shafqatevo commented 2 years ago

Thanks, @jart !