Re: More on Lisp structures performance

"Tim Bradshaw (as tfb at cley dot com)" <[email protected]>
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
On 25 Jan 2026, at 18:09, Martin Simmons <[email protected]> wrote:
> 
> You just make all objects use a multiple of 16 bytes of memory and waste a
> word for those that are actually 8 bytes smaller.

Exactly so.  And indeed for LW we do not need to theorise about how big objects are (neither for SBCL):

LW:

  ? (find-object-size 16.0d0)
  16

SBCL:

  * (primitive-object-size 1.0d0)
  16

A question to ask is: what are the single-word types that are interesting?  The two obvious ones are full-word integers and full-word floats.  Beyond that you're running on fumes: special tiny strings, perhaps, tiny arrays of very small integers?  I don't think you can easily do locatives this way (you likely want a pointer to the start of the object you're pointing into as well, so the GC knows not to collect it) and in any case they're not a standard feature of the language.

Well, the answer for the numeric types is that you really want the compiler to be able to deal with them directly: the performance difference between programs which cons floats and programs which don't is usually enormous.  If you only cons a tiny number of the things then you don't care about them being two words.

It's just much better, I think, to prevent these things being boxed at all than to worry about how big the boxes are.

--tim

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.