GithubHelp home page GithubHelp logo

Comments (7)

tkaitchuck avatar tkaitchuck commented on May 20, 2024 1

Ok. c828cc6
Will be included in the next release.

from ahash.

tkaitchuck avatar tkaitchuck commented on May 20, 2024

I prefer once_cell. I actually started with it. However it pulls in a huge number of transitive dependencies (or at least it did when I last checked), and I would like to keep aHash as light as possible given how low level it is.

from ahash.

jplatte avatar jplatte commented on May 20, 2024

Just checked, once_cell has a single optional dependency (parking_lot). Same for version 1.0.1 (1.0.0 is yanked). Maybe a pre-1.0 version had more deps, but it's certainly not the case now 🙂

from ahash.

tkaitchuck avatar tkaitchuck commented on May 20, 2024

I think the trouble is that aHash would need parking_lot. Per the doc:

To implement a sync flavor of OnceCell, this crates uses either a custom re-implementation of std::sync::Once or parking_lot::Mutex. This is controlled by the parking_lot feature, which is enabled by default. Performance is the same for both cases, but the parking_lot based OnceCell is smaller by up to 16 bytes.

Which is sort of a shame, because the whole reason for the need for the lock is to block to make sure the initialization code doesn't get run multiple times. However I don't actually care about that. If there were an "ApproximatelyOnceCell" with zero deps that would be ideal.

from ahash.

jplatte avatar jplatte commented on May 20, 2024

I don't exactly understand. Is it that you wouldn't want to use once_cell with a 16 byte overhead?

from ahash.

tkaitchuck avatar tkaitchuck commented on May 20, 2024

I don't care about the 16 bytes. I care about pulling in a dependency on parking_lot. If I can avoid having all those deps and get a working solution I'd be happy. I created matklad/once_cell#133 to track the issue. Either of matklad/once_cell#61 or matklad/once_cell#53 would also be acceptable.

from ahash.

jplatte avatar jplatte commented on May 20, 2024

Oh, so the issue is no_std support. That wasn't clear before. Thanks for following up with once_cell, I'm curious to see where that goes; it would be relevant for tracing too (tokio-rs/tracing#1165).

from ahash.

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.