heapless icon indicating copy to clipboard operation
heapless copied to clipboard

Pool: Store the pointer to the next node and data in the same memory location.

Open thalesfragoso opened this issue 4 years ago • 1 comments

Instead of having:

pub struct Node<T> {
    next: AtomicPtr<Node<T>>,
    pub(crate) data: UnsafeCell<T>,
}

We could just use one location to store both things, since we don't need to know both at the same time. I made a small PoC of this:

Playground

I still have to check a few things, but I would like some opinions about this, to see if it's really sound and worth it. I then can adapt this to heapless' code and make a PR if there's a disposition to merge.

thalesfragoso avatar Jun 24 '20 02:06 thalesfragoso

Thanks for the PoC! I have been swamped lately so I have not had time to look at this, but it's on my TODO.

korken89 avatar Sep 22 '20 18:09 korken89