Fork me on GitHub
#architecture
<
2018-08-08
>
john21:08:51

have an aaaalmost working version of this integrated into tau.alpha, so SAB backed taus are automatically allocated and freed with usage. Pretty sweet.

john23:08:33

yeah, it works

john23:08:07

So there's really no compaction on the allocated state in this scheme. You just compact the references in the free index and allocate new stuff on the left-most free spaces available. Smallest free block that fits from the left wins.

john23:08:51

And it assumes all allocations are read only. And any new writes to a datastructure will produce a new write over free space. So we can lean on this free index a little harder.

john23:08:59

Could do a diff on the old-val and new-val on each swap!, then store only the new-diff on a new tau-block in mem, leaving the old val still there, then stitch it back together on read. Just leave the new address on the old block so they can be traced. But then we'd have to start tracking the old references and decide when to start free'ing them.

john23:08:39

But rather than a diff, typed-array backed persistent datastructures for CLJS would be able to live right inside the arraybuffer.

john23:08:25

It's own functional allocation scheme could probably make garbage collection pretty easy to track.

john23:08:24

Also, keep in mind, SharedArrayBuffers are intended to be the interface between JS and WASM. I don't know as much about interoperating with C/C++ memory but we'll likely be talking to those libs in CLJS via SABs.