|
From: Douglas K. <do...@go...> - 2024-06-07 17:56:58
|
> > Yeah, I thought about that already -- but one slot contains a SHA256, > so I'd need to use a bignum, which incurs a header word overhead (like > a structure). A SIMD pack has two words overhead. > > Are you really certain that columnar storage is going to net out to fewer words of memory? Consider storing the sha256 in a structure with 4 64-bit raw slots. That's the same overhead as a bignum or simd pack, and you've paid the price for a header once. So now just add some more raw slots for your other data, or non-raw for any pointer data. If you consider the sum total of all things you put into this structure, a bit-packed defstruct is going to be a lot easier to deal with than a fancy encoding/representation technique that has some of the slots in one vector, some in another vector, and both vectors disembodied from the thing that you consider "the object' (i.e. the index to the vectors). Every time someone asks why structures can't be packed as densely as in C, I wait for the follow-up question "and why can't you have type-based dispatch too?" Well, you can if you're willing to go to a completely statically compiled language model. My understanding is that Go can make structures as densely packed as in C, and gets some object-oriented-like stuff too. > (DEFTYPE my-struct-idx () SB-SYS:OTHER-IMMEDIATE-1-LOWTAG-TYPE) > > and dispatching on that (typecase, typep, CLOS methods) becomes > possible? That sounds like a really nice addition to the SBCL > internals documentation that I could write as soon as it works. > I will look the other way just long enough for you to prototype it and see if it works. I can't actually assert that the GC is fully robust against other random uses of the unallocated immediate lowtags. |