Giter Site home page Giter Site logo

make index type `NonZeroUsize` about sharded-slab HOT 4 OPEN

hawkw avatar hawkw commented on May 18, 2024 2
make index type `NonZeroUsize`

from sharded-slab.

Comments (4)

hawkw avatar hawkw commented on May 18, 2024

We could do this — it might be useful for the tracing-subscriber use-case, as well, where we're currently adding 1 to all indices because 0 is reserved.

However, 0 is a valid slab index. If we did this, we would either end up wasting one slot on thread 0's slab, or need to do some munging of indices ourselves to avoid that. This may be worth it, however.

from sharded-slab.

inanna-malick avatar inanna-malick commented on May 18, 2024

Would it be reasonable to add an associated Key type to the Config trait, with the default being usize to allow for custom configs that use std::num::NonZeroUsize instead?

from sharded-slab.

hawkw avatar hawkw commented on May 18, 2024

@inanna-malick hmm, in theory, that could work! Could be worth experimenting with.

from sharded-slab.

inanna-malick avatar inanna-malick commented on May 18, 2024

I have a sketch of what it might look like here - it's not quite complete (I don't quite understand everything that's going on around key generation & what would be required to skip 0 there) but it shows the approximate scope of the changes https://github.com/inanna-malick/sharded-slab/tree/associated-key-type

from sharded-slab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.