Skip to content
Snippets Groups Projects
Commit 9cd7308e authored by Daniel Kochmański's avatar Daniel Kochmański
Browse files

encapsulation: add dynamic-extent declaration

Fix proposed by Cliff Brunk:

"I use your Common Lisp metering system pretty often on under MCL 2.01.
Thanks for making this nice profiling tool available, it has helped alot.
However, I notied that the amount of space used by functions that contain
an &optional is much higher for the monitoring-encapsulation than
from the original function.  I beleive this is because the encapsulation
creates a list for the optional arguments using &rest.  If one adds
a dynmaic-extentent declaration after the lambda list in many implementations
of Common Lisp the &rest arglist will be stack allocated and the amount of
storage reported will be a truer indication of how the function performs
outside of the encapsulation.  Below is the modification that I'm currently
using and seems to work at least under MCL.

Cliff Brunk"
parent a21795aa
No related branches found
No related tags found
No related merge requests found
......@@ -700,6 +700,9 @@ adjusted for overhead."
(setf (place-function name)
#'(lambda (,@required-args
,@(when optionals-p `(&rest optional-args)))
,(when optionals-p
;; &rest optional-args can be stack allocated
`(declare (dynamic-extent optional-args)))
(let ((prev-total-time *total-time*)
(prev-total-cons *total-cons*)
(prev-total-calls *total-calls*)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment