Thanks very much for your reply.
VECTOR-PUSH-EXTEND doesn't look that big to me. All the tricky work seems
to be in ADJUST-ARRAY, which is not called frequently, and hence doesn't
need to be inlined.
I don't think AREF for adjustable vectors is currently being inlined, but
maybe I'm misinterpreting something. When I compile the following:
(defun silly8 ()
(declare (optimize (debug 0) (safety 0) (speed 3)))
(let ((intvector (make-array 10000010
(dotimes (i 10000000)
(setf (aref intvector i) i))))
I initially get the following note, which confuses me a bit. The note seems
to imply that a (VECTOR FIXNUM) is not of type SIMPLE-ARRAY, which is
contrary to my expectation. Maybe the error message is just unclear. The
(VECTOR FIXNUM) it's complaining about is most likely the adjustable
INTVECTOR, in which case the message should mention the adjustable property.
; in: LAMBDA NIL
; (SETF (AREF INTVECTOR I) I)
; --> SB-KERNEL:%ASET LET* SB-KERNEL:HAIRY-DATA-VECTOR-SET
; --> MULTIPLE-VALUE-CALL
; (SB-KERNEL:%DATA-VECTOR-AND-INDEX ARRAY SB-INT:INDEX)
; note: unable to
; due to type uncertainty:
; The first argument is a (VECTOR FIXNUM), not a SIMPLE-ARRAY.
; compilation unit finished
; printed 1 note
Anyway, when I look at the assembly code for SILLY8, I see a call to
SB-KERNEL:%DATA-VECTOR-AND-INDEX in the loop, which I thought was
responsible the doing the (SETF AREF).
Also, if you don't have time to integrate your patch for VECTOR-PUSH, I'm
willing to give it a try.
Date: Fri, 14 Nov 2003 07:14:06 -0600
From: William Harold Newman <william.newman@...>
Sender: William Harold Newman <william.newman@...>
On Thu, Nov 13, 2003 at 02:11:48PM -0800, Robert E. Brown wrote:
<<< quoted message deleted >>>
I had noticed some of this too, and in fact I have had a modified
definition of VECTOR-PUSH-EXTEND in my .sbclrc for at least a month.
It's not inline, since I have misgivings about expanding that much
code inline, but at least it picks off the common (VECTOR T) case
and handles it more efficiently. Recently I've been preoccupied
with making my code work at all rather than optimizing its
performance, so I haven't paid much attention to issues like this.
But maybe I should at least try to find some way to justify my
new version with a little benchmark and then merge it into CVS.
My dim memory is that a long time ago I arranged for AREF to be
inlined on adjustable vectors when enough type information was
provided. Thus, if it's not inlined now, it may be some kind of code
rot or someone tuning with different priorities. Probably it ought to
be inlined at least when (> SPEED SPACE) and the upgraded array
element type is known.
William Harold Newman <william.newman@...>
We were bedevilled by the daemons of diagrammatic overdesign. My God,
three little boxes drawn on the back of a napkin, Game, Frame, and
Throw, and it was still too complicated and just plain wrong.
-- Robert C. Martin, _Agile Software Development_, p. 72
PGP key fingerprint 85 CE 1C BA 79 8D 51 8C B9 25 FB EE E0 C3 E5 7C