;;;-*- Mode:LISP; Package:BENCH-TAKLU; Source->source-optimizations:T; Base:8 -*- ;;; From the "Dick Gabriel" Benchmark Series. ;;; Enhancements (C) Copyright 1983, Lisp Machine, Inc. (EVAL-WHEN (EVAL COMPILE LOAD) (DEFCONST *TO-UCOMPILE* '(mas shorterp)) (MAPC #'(LAMBDA (X) (PUTPROP X T 'COMPILER:MICROCOMPILE) (PUTPROP X T ; ':DYNAMIC ':DEPEND-ON-BEING-MICROCOMPILED)) *TO-UCOMPILE*)) ;;;BEGIN ;;;TAKL (defun listn (n) (cond ((= 0 n) nil) (t (cons n (listn (1- n)))))) (defun mas (x y z) (cond ((not (shorterp y x)) z) (t (mas (mas (cdr x) y z) (mas (cdr y) z x) (mas (cdr z) x y))))) (defun shorterp (x y) (and y (or (null x) (shorterp (cdr x) (cdr y))))) ;benchmark is called ;(mas (listn 18) (listn 12) (listn 6)) ;(include "timer.lsp") (declare (special 18l 12l 6l)) (setq 18l (listn 18.) 12l (listn 12.) 6l (listn 6.)) ;;;END (DEFCONST *UCODE-LOADED? NIL) (DEFUN LOAD-UCODE (&optional setup) (lexpr-funcall #'COMPILER:MA-LOAD *TO-UCOMPILE*) (SETQ *UCODE-LOADED? T) (if setup (setup))) (TIMER TIMIT (IF *UCODE-LOADED? (mas 18l 12l 6l) "ucode not loaded, no test run"))