[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Re: lisp performance questions and observations

From: Camm Maguire
Subject: [Gcl-devel] Re: lisp performance questions and observations
Date: 25 Oct 2004 11:43:29 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

The following message is a courtesy copy of an article
that has been posted to comp.lang.lisp as well.


rif <address@hidden> writes:

> > I'd try gcl, ecl or ThinLisp.
> I have taken a brief look at each of these.  My initial impression is
> that they do not actually solve the issues I have.  Specifically, I
> would want to declare a structure type, and then lay out an array of
> that structure type directly in memory.  (In standard CL, I get an
> "array of pointers", leading to an extra word/struct and an extra
> indirection on every access.)  Do you know (or have high confidence)
> that any of these actually let me do this?  If not, I'm not sure how
> they help me.

You can certainly do anything like this you desire with GCL -- it is
really a question of whether you'd like to edit the GCL source or not.

If you have an opague struct, i.e. no lisp pointers therein, the
simplest thing is to declare an array of fixnum multiplying the
dimension by sizeof(struct)/sizeof(fixnum) and adjusting the array
indices via a simple function.  You can then define C functions to
extract the elements from within lisp via #'clines and address@hidden  See
the gcl-si docs.  What is key here is that the garbage collector will
not traverse the contents of the array iff they are of an 'opaque'
type like fixnum.  The default, type object, though of the same size,
will result in code that tries to dereference your structure contents
as lisp pointers.  

More sophisticated approaches would entail defining other opaque array
types in o/array.c and/or modifying the gc algorithm should one need
lisp pointers somewhere in the struct.

Take care,

> Cheers,
> rif

Camm Maguire                                            address@hidden
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]