Git Product home page Git Product logo

Comments (4)

Amanieu avatar Amanieu commented on July 17, 2024

The API of this crate is identical to the one for the libstd HashMap. So no, it probably isn't possible to implement your idea on top of hashbrown.

I'm not even sure if lazy deletion would even be a performance improvement: it means that you have to scan all elements on insert, which is incompatible with SwissTable's SIMD lookup algorithm.

from hashbrown.

typesanitizer avatar typesanitizer commented on July 17, 2024

Gotcha'. I'm not sure what you mean by "scan all elements" though... You can only scan the ones which are possible candidates for insertion. If the first slot you inspect (for insertion) is empty, then you just insert the pair in there, no deletions involved, even though you might have outdated key-value pairs lying around.

from hashbrown.

Amanieu avatar Amanieu commented on July 17, 2024

What I mean is that hashbrown doesn't even look at the elements when searching for a slot for insertion, it only looks at the hashes until it finds a matching hash or an empty slot. SIMD allows scanning 16 hashes in a single instruction, which is the main reason why hashbrown is faster than the standard library. Changing this scan to additionally check scopes and outdated generations would greatly increase complexity and slow insertions down significantly.

from hashbrown.

typesanitizer avatar typesanitizer commented on July 17, 2024

Oh, I see. Thanks for the explanation and (super) speedy response. Also, thanks for writing this crate 😄.

from hashbrown.

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.