Remix.run Logo
nielsbot 5 days ago

Wonder how this compares to combining pointers with indices (effectively):

Allocate your nodes in contiguous memory, but use pointers to refer to them instead of indices. This would remove an indirect reference when resolving node references: dereference vs (storage_base_address + element_size * index) Resizing your storage does become potentially painful: you have to repoint all your inter-node pointers. But maybe an alternative there is to just add another contiguous (memory page-sized?) region for more nodes.

Lots of trade offs to consider :)

munch117 5 days ago | parent [-]

You have just reinvented the slab allocator.

nielsbot 5 days ago | parent [-]

Sure—-But I was specifically thinking in the context of this article