Giter VIP home page Giter VIP logo

Comments (1)

dbaarda avatar dbaarda commented on September 26, 2024

After thinking about this a bit more, older values will expire from the hash in a probabilistic way when using a right-shift. This means the effective window size is variable, but the probabilities of it getting large are actually small. There could still be degenerate cases that make it very large, but on average, assuming random behavior, it should be OK.

Using a right-shift, the hash becomes the most significant 32 bits of a very large sum of values, where the oldest byte is adding a 32 bit number to the sum. Assuming random numbers, there is a 50% chance that this propagates a bit change to to the 33rd bit, 25% change to the 34th bit, etc. So the chance that it propagates a bit change into the most significant 32 bits used for the hash is 1/2^(len-32), where len is the number of bytes included in the sum. So there is a less than 0.4% chance of the effective sliding window being larger than 40 bytes.

So I think using a right-shift is probably OK, and the effective increase in the sliding window size probably helps more by strengthening the hash more than the problems caused by the low chance of it getting too big. It's probably worth testing.

from deduplication.

Related Issues (5)

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.