Ronald Vogelaar wrote: > Theodore H. Smith wrote: > >> I use double-linked lists for file caching. Then I moved it over to >> using my RingTree class. It's slightly wasteful here, because for >> each object, 8 bytes are wasted on unneeded parent and child >> properties. But it's OK really. 8 bytes per object isn't much when >> you have around 200 objects max. >> >> > You could get aound this 'issue' by using a XOR linked list instead of a > double linked list. >
Before Theo's plugin had a RingTree class I had created my own doubly linked list in RB. I tried to make it a XOR list, but at the time I couldn't bend my mind around it. Now that Theo offers a RingTree I'm using that, of course. The theory behind a XOR list is that instead of two pointers (back and forth) you use just one. Like this: Doubly linked: *Previous *Next *Data XOR: *Difference *Data You'd use half the memory for the node/leaf pointers at the cost of more complexity and, I suspect, slower traversals. Ronald Vogelaar http://www.rovosoft.com _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
