From 74eab1e7a690bef36116cd33fa23fd611f3d3ed0 Mon Sep 17 00:00:00 2001 From: davidly Date: Thu, 4 Jul 2024 21:50:07 -0700 Subject: [PATCH] add other benchmarks --- Ashwood-Smith PC-LISP v3/E.LSP | 44 +++++++++++++++++++++ Ashwood-Smith PC-LISP v3/SIEVE.LSP | 61 ++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 Ashwood-Smith PC-LISP v3/E.LSP create mode 100644 Ashwood-Smith PC-LISP v3/SIEVE.LSP diff --git a/Ashwood-Smith PC-LISP v3/E.LSP b/Ashwood-Smith PC-LISP v3/E.LSP new file mode 100644 index 0000000..e4e72c5 --- /dev/null +++ b/Ashwood-Smith PC-LISP v3/E.LSP @@ -0,0 +1,44 @@ +; Compute e to 192 digits + +(setq digits 200) +(array a t digits) +(setq high digits) +(setq count 0) +(setq x 0) +(setq n (- high 1)) + +(defun rune() (prog () + _nextn_ + (a 1 n) + (cond ((plusp n) + (setq n (sub1 n)) + (go _nextn_)) + ) + + (a 2 1) + (a 0 0) + + _nexthigh_ + (setq high (sub1 high)) + (setq n high) + _nextn2_ + (a (mod x n) n) + (setq x (+ (* 10 (a (sub1 n))) (/ x n))) + (cond ((> n 1) + (setq n (sub1 n)) + (go _nextn2_)) + ) + (princ x) + (cond ((> high 9) + (go _nexthigh_)) + ) + + (return 0) +)) + +(setq startTime (sys:time)) +(rune) +(setq endTime (sys:time)) +(princ "\nelapsed seconds: ") (princ (- endTime startTime)) (princ "\n") + +(exit) diff --git a/Ashwood-Smith PC-LISP v3/SIEVE.LSP b/Ashwood-Smith PC-LISP v3/SIEVE.LSP new file mode 100644 index 0000000..94149c8 --- /dev/null +++ b/Ashwood-Smith PC-LISP v3/SIEVE.LSP @@ -0,0 +1,61 @@ +; BYTE magazine's Sieve benchmark + +(setq size 8190) +(setq sizep1 (+ size 1)) +(array a t sizep1) +(setq count 0) +(setq i 0) +(setq l 0) + +(defun runsieve() (prog () + (setq i 0) + (setq count 0) + _nexti_ + (cond ((< i size) + (a t i) + (setq i (add1 i)) + (go _nexti_)) + ) + + (setq i 0) + _nexti2_ + (cond ((< i size) + (cond ((a i) + (setq prime (+ i i 3)) + (setq k (+ i prime)) + (prog () + _nextk_ + (cond ((< k size) + (a nil k) + (setq k (+ k prime)) + (go _nextk_)) + ) + ) + (setq count (add1 count))) + ) + (setq i (add1 i)) + (go _nexti2_)) + ) +)) + +(defun main() (prog () + (setq startTime (sys:time)) + + (setq l 1) + _nextl_ + (cond ((<= l 10) + (runsieve) + (princ l) (princ " ") + (setq l (add1 l)) + (go _nextl_)) + ) + + (princ "count: ") (princ count) (princ "\n") + (setq endTime (sys:time)) + (princ "\nelapsed seconds: ") (princ (- endTime startTime)) (princ "\n") +)) + +(main) + +(exit) +