;;;-*- Mode:LISP; Package:BENCH-DIV2U; Base:10 -*- ;;; From the "Dick Gabriel" Benchmark Series. ;;; Enhancements (C) Copyright 1983, Lisp Machine, Inc. (EVAL-WHEN (EVAL COMPILE LOAD) (DEFCONST *TO-UCOMPILE* '(div2 dv2 test1 test2)) (MAPC #'(LAMBDA (X) (PUTPROP X T 'COMPILER:MICROCOMPILE) (PUTPROP X T ; ':DYNAMIC ':DEPEND-ON-BEING-MICROCOMPILED)) *TO-UCOMPILE*)) ;;;BEGIN ;;;DIV2 ;;; Dividing by 2 using lists of n ()'s (defun create-n (n) (do ((n n (1- n)) (a () (push () a))) ((= n 0) a))) (defun div2 (l) (do ((l l (cddr l)) (a () (push (car l) a))) ((null l) a))) (defun dv2 (l) (cond ((null l) ()) (t (cons (car l) (dv2 (cddr l)))))) (defun test1 (l) (do ((i 300. (1- i))) ((= i 0)) (div2 l) (div2 l) (div2 l) (div2 l))) (defun test2 (l) (do ((i 300. (1- i))) ((= i 0)) (dv2 l) (dv2 l) (dv2 l) (dv2 l))) (declare (special l)) (setq l (create-n 200.)) ;(include "timer.lsp") (defconst *ucode-loaded? nil) (defun load-ucode () (apply #'compiler:ma-load *to-ucompile*) (setq *ucode-loaded? t)) (timer-without-interrupts timit1 (if *ucode-loaded? (test1 l) "ucode-not-loaded")) (timer-without-interrupts timit2 (if *ucode-loaded? (test2 l) "ucode-not-loaded")) ;;;END