Giter Site home page Giter Site logo

Comments (2)

hawkw avatar hawkw commented on May 18, 2024

Other options include:

  • Actually using a condvar here.
    • The reason we're not using one now is that it would only be used in take, and would mean adding a mutex/condvar pair to every slot. This would mean two heap allocations per slot, plus increasing the size of each slot itself by 32 bytes (on linux/x86_64, see https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=5c07e4a6cbf9e3755ff5543a9062d6d9)
    • Using a mutex/condvar pair would also be an obstacle to porting this code to no_std, which is an eventual goal...although we could just make the take method require std.
  • Just remove this API entirely in 0.1. I'm not sure how much of a use-case there is for it OTTOMH (tracing-subscriber doesn't use it).

from sharded-slab.

hawkw avatar hawkw commented on May 18, 2024

Another option is that we could consider adding a proper backoff here. We would still be spinning, but could have the thread sleep while spinning rather than just emitting pause instructions. That would be an obstacle to porting to no_std, but this code currently doesn't work on no_std, and we could just feature flag it.

This might be a good compromise between not burning CPU in a tight spin loop and having to allocate a mutex/condvar pair for every slot.

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.