summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2013-07-21 00:24:38 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2013-07-21 00:24:38 +0200
commit75e0a7ccf136a8275c91b37ad72f33d053c025b0 (patch)
treedfcf24d96ff71f1459a31b8bca447f085aab1321
parentafc9f4d822c8ce2c3a9cfdbb43a2c664c945acc4 (diff)
LAMBDA: DYNAMIC-EXTENT-declare ITER helper.
This improves performance of the recursive, PROGV-based approach to dynamic binding to be on par with non-recursive binding based on SBCL primitives.
-rw-r--r--sb-eval2.lisp8
1 files changed, 7 insertions, 1 deletions
diff --git a/sb-eval2.lisp b/sb-eval2.lisp
index f5fb4dd..db4ded3 100644
--- a/sb-eval2.lisp
+++ b/sb-eval2.lisp
@@ -468,6 +468,12 @@
,@body))
(,loop-var ,@(mapcar #'second bindings))))
+(defmacro dnlet (loop-var bindings &body body)
+ `(labels ((,loop-var ,(mapcar #'first bindings)
+ ,@body))
+ (declare (dynamic-extent #',loop-var))
+ (,loop-var ,@(mapcar #'second bindings))))
+
(declaim (ftype (function * eval-closure) prepare-lambda))
(defun prepare-lambda (lambda-form context &key (name nil namep))
(destructuring-bind (lambda-list &rest exprs) lambda-form
@@ -536,7 +542,7 @@
;; All this ELT and LENGTH stuff is not as
;; inefficient as it looks. SBCL transforms
;; &rest into &more here.
- (nlet iter
+ (dnlet iter
((rest
(when (or restp keyp)
(loop for i