home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / usr.bin / lisp / lispnews / text0223.txt < prev    next >
Encoding:
Text File  |  1985-11-10  |  554 b   |  24 lines

  1. Here's a good benchmark:
  2.  
  3. (defun nilret () nil)
  4.  
  5. this is a good test of how fast your lisp returns NIL.
  6.  
  7. I also like
  8.  
  9. (defun retjunk (x) (cond((junkp x)  'junk)
  10.                  ((cdr x) (retjunk (car x)))
  11.                  ((= (car x) 'junk) (retjunk (cons (cdr x) (cdr x))))
  12.                  (t (retjunk (cons 'junk x))))
  13.  
  14. (defun junkp (x) (equal (reverse (explode x)) (reverse (explode
  15. 'junk))))
  16.  
  17.  
  18. This benchmark measures how fast your lisp can return junk, executing
  19. the retjunk function.
  20.  
  21. Both of the benchmarks have the adavantage that they are small and can
  22. be abused as benchmarks.
  23.  
  24.