Re: unboxed structure fields (or class slots)

"Yuri Davidovsky (as work at disclosure dot ie)" <[email protected]>
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
> On 7 Jan 2026, at 15:19, Tim Bradshaw <[email protected]> wrote:
> 
> That's not saying people *can't* do better in languages which can cast: just that most of the time they don’t.

I am quite sure you can do better than most people in languages that can cast, with a language than cannot.

The particular benefit of SoA is specifically is in being able to use SIMD processing easily. Since that by most part is not relevant for lisps, it may be that in your particular case the byte-to-struct cast AoS would be of preference here, which should be easy enough to implement using typed aref arrays in LW. By putting together some relatively simple accessor macros you could probably hit the scalar performance of C code for structs while using these custom structs of your own (not just simple fundamental types).

Obviously that is not going to be portable, which may, or may not be an issue for the problem you are solving, but if you do need to be able to run on various lisps, in that case the multiple packed arrays would be the way to go. In theory it should be slower than the custom struct + typed aref approach, but probably not significantly for structs with a small number of fields and machines with a decent amount of cache (M1 does have that).

The accessor and constructor complexity would probably be comparable in either approach.

_______________________________________________
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.