[armedbear-devel] Patch for LispThread.java, do not copy arrays in StackFrame

Mark Evenson evenson at panix.com
Wed Jul 29 07:30:54 UTC 2009

On 7/24/09 12:31 AM, Ville Voutilainen wrote:
> Here's a very simple patch that should make function calls faster. I
> have only anecdotal tests with the raytracing shootout test and the
> compiled ansi-tests, but the numbers seem to support this patch.
> If nobody objects, I'll commit this.

Sorry for the late reply.

In this case, I think it is the correct decision to copy the reference 
as opposed to the values into StackFrame.  Presumably the args never go 
out of scope as long as its corresponding StackFrame is contained in 

But if we wished to retain the code, there is a little Java "trick" for 
copying arrays, namely that java.lang.System contains a arraycopy() method:

    static void arraycopy(Object src, int srcPos, Object dest,
			 int destPos, int length)

which "Copies an array from the specified source array, beginning at the 
specified position, to the specified position of the destination array."

In the Sun JVM 1.1 this was at least an order or two of magnitude faster 
in array copies for largish arrays (I think it translated down to the 
equivalent memcpy() on the native platform).  I'm not sure what the 
current JVM implementation what the speed gains might be, but it is 
useful to keep in mind.


"A screaming comes across the sky.  It has happened before, but there
is nothing to compare to it now."

More information about the armedbear-devel mailing list