bf: rePUT, 3.5x perf with mp type decl
~3.6s mandelbrot
This commit is contained in:
parent
64b5785bcc
commit
765c4ecacc
2 changed files with 14 additions and 2 deletions
4
bf.lisp
4
bf.lisp
|
@ -54,6 +54,8 @@
|
|||
`(loop until (zerop cell)
|
||||
do (progn ,@inner)))
|
||||
out))))
|
||||
;; WE NEED TO PUT BECAUSE LOOPS IDOIT!
|
||||
finally (put)
|
||||
finally (return (nreverse out)))))
|
||||
|
||||
(defparameter mem-size 32768)
|
||||
|
@ -65,6 +67,8 @@
|
|||
(begin
|
||||
(= mem (make-array ,mem-size :element-type '(unsigned-byte 8)))
|
||||
(= mp 0)
|
||||
(declare (type (mod ,mem-size) mp))
|
||||
|
||||
(=sm cell (aref mem mp))
|
||||
|
||||
(=f inc (n) (incmodf cell 256 n))
|
||||
|
|
12
utils.lisp
12
utils.lisp
|
@ -664,6 +664,15 @@
|
|||
;; (defmacro <>-> (val &body body)
|
||||
;; `(as-> ,val <> ,@body))
|
||||
|
||||
;; the value of this is that (-> x car) is (car x) instead of (let1 it x (car x)), enabling setf
|
||||
(defmacro -> (x &body body)
|
||||
(match body
|
||||
((cons (cons f xs) rest)
|
||||
`(-> (,f ,x ,@xs) ,@rest))
|
||||
((cons f rest)
|
||||
`(-> (,f ,x) ,@rest))
|
||||
(nil x)))
|
||||
|
||||
(defmacro doprod ((&rest binds) &body body)
|
||||
(if (null binds)
|
||||
`(progn ,@body)
|
||||
|
@ -690,9 +699,8 @@
|
|||
`(let-match1 ,pattern (progn ,@body)
|
||||
(begin ,@rest)))
|
||||
|
||||
;; consider LABELS
|
||||
((structure ('=f name args . body))
|
||||
`(flet ((,name ,args (begin ,@body)))
|
||||
`(labels ((,name ,args (begin ,@body)))
|
||||
(begin ,@rest)))
|
||||
|
||||
((structure ('=m name args . body))
|
||||
|
|
Loading…
Reference in a new issue