boxcar icon indicating copy to clipboard operation
boxcar copied to clipboard

Add a concurrent, append-only `SlotMap`

Open SabrinaJewson opened this issue 8 months ago • 4 comments

Apologies for the rewrite-your-entire-crate PR, but you did say I could do this =)

In this PR, we split the logic of Vec into two parts: an underlying Buckets type, which manages the exponentially-growing sequence of buckets, and Vec itself, which wraps Buckets by managing initialization and length. We then write SlotMap in terms of Buckets, allowing the implementation to focus on the algorithm, while hiding details of arithmetic and allocation.

We have API parity with regular slotmap (at the time of writing), though not an identical API.

SabrinaJewson avatar May 11 '25 18:05 SabrinaJewson

Oh, right. CI is failing for two reasons:

  1. MSRV, which needs 1.83. I already bumped to 1.81.0, but I should ask what the policy is here.
  2. I moved boxcar::{Iter, IntoIter}boxcar::vec::{Iter, IntoIter}. If we’re making a breaking change anyway then we might as well keep, but if MSRV isn’t a breaking change then I could reexport.

SabrinaJewson avatar May 11 '25 18:05 SabrinaJewson

Thanks, this looks really cool! Just a heads up that it might take me a little while to get around to reviewing it, but the overall direction looks great.

ibraheemdev avatar May 11 '25 21:05 ibraheemdev

What do you think about splitting the buckets API into a separate PR (apart from the new slotmap API)? That would make it easier to review, and hopefully we could merge that part sooner and avoid having to keep it in-sync with new changes — it's already been a while and I'd like to get those changes in. It's also possible that the slotmap API could be a separate crate (but we can have that discussion in the other PR).

ibraheemdev avatar Jun 19 '25 02:06 ibraheemdev

Alright, I’ve now rebased on master. And CI passes =)

SabrinaJewson avatar Aug 04 '25 22:08 SabrinaJewson