Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binary fuse filter: allow size=0,size=1,size=2 and add tests #27

Merged
merged 1 commit into from
Aug 22, 2021
Merged

binary fuse filter: allow size=0,size=1,size=2 and add tests #27

merged 1 commit into from
Aug 22, 2021

Commits on Aug 21, 2021

  1. binary fuse filter: allow size=0,size=1,size=2 and add tests

    In dabe365 checks were added to prevent
    creation of filters with `size <= 1`, and while these incredibly small
    sizes are not particularly useful in a binary fuse filter, keeping the
    property that all sizes `[0..N]` are allowed is nice due to the fact
    that, if the restriction is in place, you must:
    
    * Verify your set length is >= 1.
    * If it isn't, use a separate code path to lookup and encode your 0, 1, or 2 keys
      outside the binary fuse filter. And also handle encoding that to a file if you
      e.g. intend to serialize the filter to disk.
    
    With this change, input sizes 0,1,2 are allowed and consume no more
    memory than size=3 (there is no overflow condition in calculating the
    array length.)
    
    Also added a few tests for these three edge cases.
    
    Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
    slimsag committed Aug 21, 2021
    Configuration menu
    Copy the full SHA
    0fab189 View commit details
    Browse the repository at this point in the history