[Larceny-users] make-bytevector and bytevector-copy

Eduardo Cavazos wayo.cavazos at gmail.com
Sun Feb 15 14:38:34 EST 2009


Hello,

When profiling my program, I notice 'get-modelview-matrix' is 
consistently high in the list. Here it is:

(define (get-modelview-matrix)
   (let ((bv (make-bytevector (* 16 8))))
     (glGetDoublev GL_MODELVIEW_MATRIX bv)
     bv))

I could write it like this:

(define get-modelview-matrix
   (let ((bv (make-bytevector (* 16 8))))
     (lambda ()
       (glGetDoublev GL_MODELVIEW_MATRIX bv)
       bv)))

That's of course much faster. But, one of the callers of 
'get-modelview-matrix' really does need a copy of the matrix. So I 
modified the call site as such:

     (bytevector-copy (get-modelview-matrix))

and then 'bytevector-copy' shows up high in the list. :-)

So my question is, is the first version of 'get-modelview-matrix' shown 
above inherently "hot"?

Ed



More information about the Larceny-users mailing list