avoid consing &REST args when they just get passed to APPLY
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Wishlist
|
Unassigned |
Bug Description
I remember reading about this optimization in a post on c.l.l by Duane Rettig, though I cannot find it now. What the optimization does is recognize the idiom:
(defun func (a b &rest args)
... ; doesn't use ARGS
(apply newfunc a b c args))
and avoids consing a list for ARGS, either on the heap or the stack. Instead, you shuffle ARGS around on the stack to ensure it's in the proper place for the call to NEWFUNC.
I think this would be reasonably straightforward as an IR2 optimization (recognize presence of %LISTIFY-REST-ARGS, verify that its argument is not used except as arg to VALUES-LIST, etc.), though there might be some trickiness doing the argument shuffling properly and efficiently.
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
In 1.0.48.25.