home *** CD-ROM | disk | FTP | other *** search
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; File: fprint.cl
- ; Description: FPRINT benchmark
- ; Author: Richard Gabriel
- ; Created: 11-Apr-85
- ; Modified: 9-Jul-85 21:11:33 (Bob Shaw)
- ; Language: Common Lisp
- ; Package: User
- ; Status: Public Domain
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- ;;; FPRINT -- Benchmark to print to a file.
-
- (defvar test-atoms '(abcdef12 cdefgh23 efghij34 ghijkl45 ijklmn56 klmnop67
- mnopqr78 opqrst89 qrstuv90 stuvwx01 uvwxyz12
- wxyzab23 xyzabc34 \123456ab \234567bc \345678cd
- \456789de \567890ef \678901fg \789012gh \890123hi))
-
- (defun init-aux (m n atoms)
- (cond ((= m 0) (pop atoms))
- (t (do ((i n (- i 2))
- (a ()))
- ((< i 1) a)
- (push (pop atoms) a)
- (push (init-aux (1- m) n atoms) a)))))
-
- (defun init (m n atoms)
- (let ((atoms (subst () () atoms)))
- (do ((a atoms (cdr a)))
- ((null (cdr a)) (rplacd a atoms)))
- (init-aux m n atoms)))
-
- (defvar test-pattern (init 6 6 test-atoms))
-
- (defun fprint ()
- (if (probe-file "fprint.tst") ; seems a little wierd, later calls slower
- (delete-file "fprint.tst"))
- (let((stream (open "fprint.tst" :direction :output)))
- (print test-pattern stream)
- (close stream)))
-
- (eval-when (compile load eval)
- (if (probe-file "fprint.tst")
- (delete-file "fprint.tst")))
-
- ;;; call: (fprint)
-
- (run-benchmark "Fprint" '(fprint))
-