Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

45 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Prefix Filter

This repository now focuses on newFilter 2.0 (adpHash + Columbia/LG datasets) running on Linux. The original Prefix-Filter implementation is still included (see the Legacy Prefix-Filter section).

If you plan on using the Prefix-Filter, please cite our paper: Prefix Filter: Practically and Theoretically Better Than Bloom. Tomer Even, Guy Even, Adam Morrison. To appear in PVLDB, 15(7).

Short talk about the Prefix Filter: https://www.youtube.com/watch?v=KMVtvACSGo0

Prerequisites (Linux)

  • Compiler: A C++17 compiler such as GNU G++ or LLVM Clang++.
  • CMake (Version 3.10 or higher).
  • System: Linux.
  • Hardware: Intel. Support of AVX512 is a must.
Python Packages To Produce The Graphs
  • matplotlib
  • brokenaxes (From here).
  • pandas

There are three main targets for three different benchmarks.

  1. measure_perf for benchmarking performance of insertions and lookups under various loads.
  2. measure_build for build-time.
  3. measure_fpp for evaluating the false positive probability, and the "effective space consumption".

There is also an example of how to use the Prefix-Filter in the file example.cpp:

#include "Tests/wrappers.hpp"

int main(){
    using spare = TC_shortcut; // Any incremental filter can replace TC_shortcut.
    using prefixFilter = Prefix_Filter<spare>; 

    size_t filter_max_capacity = 1'000'000; // Choose any size.
    prefixFilter example_filter = FilterAPI<prefixFilter>::ConstructFromAddCount(filter_max_capacity);

    uint64_t x1 = 0x0123'4567'89ab'cdef;
    FilterAPI<prefixFilter>::Add(x1, &example_filter); // Insertions of an item x1. Insertion can be performed only one step at a time.

    bool res = FilterAPI<prefixFilter>::Contain(x1, &example_filter); // Lookup of x1.
    assert(res); //No false negative.
    
    uint64_t y1 = ~0x0123'4567'89ab'cdef;
    bool res2 = FilterAPI<prefixFilter>::Contain(y1, &example_filter); // Lookup of y1.
    std::cout << res2 << std::endl; // Possible false positive. (Although with one item in the filter, this is highly unlikely.)
    return 0;
}

To build

git clone -b master https://github.com/TheHolyJoker/Prefix-Filter.git
cd Prefix-Filter
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
t="measure_perf measure_built measure_fpp"; time cmake --build ./ --target $t -j 20

On GCC release: Older releases like 9.3 will work. We recommend using newer releases, which seems to perform better.

To Run

To run all benchmarks (from Prefix-Filter/build directory):

cp ../RunAll.sh RunAll.sh 
./RunAll.sh
Specific Target

Any specific target (for example measure_perf) can be built and executed with as follows:

t="measure_perf"; time cmake --build ./ --target $t -j 20 && time taskset -c 2 ./$t 

newFilter 2.0 (adpHash + Columbia/LG datasets) — Linux main workflow

Filter: SimHash-4x16-OR (single-way dedup; uses one 16‑bit segment with 12‑bit bin + 4‑bit fingerprint).
Datasets: ColumbiaArchive/coil-100 and LGarchive/dataset.
Hashes: 64‑bit aHash / dHash / pHash generated by newFilter/hash_images.py.

One‑shot runner (recommended)

This runs both datasets × three hashes, produces results and PDFs, and archives per‑run outputs.

cd /home/user/FastFilter/FastFilter
chmod +x run_manual.sh
./run_manual.sh

Manual steps (explicit commands)

1) Generate six hash files

python3 /home/user/FastFilter/FastFilter/newFilter/hash_images.py --input /home/user/FastFilter/FastFilter/ColumbiaArchive/coil-100 --method phash --output /home/user/FastFilter/FastFilter/scripts/Inputs/columbia_phash.txt
python3 /home/user/FastFilter/FastFilter/newFilter/hash_images.py --input /home/user/FastFilter/FastFilter/ColumbiaArchive/coil-100 --method dhash --output /home/user/FastFilter/FastFilter/scripts/Inputs/columbia_dhash.txt
python3 /home/user/FastFilter/FastFilter/newFilter/hash_images.py --input /home/user/FastFilter/FastFilter/ColumbiaArchive/coil-100 --method ahash --output /home/user/FastFilter/FastFilter/scripts/Inputs/columbia_ahash.txt

python3 /home/user/FastFilter/FastFilter/newFilter/hash_images.py --input /home/user/FastFilter/FastFilter/LGarchive/dataset --method phash --output /home/user/FastFilter/FastFilter/scripts/Inputs/lg_phash.txt
python3 /home/user/FastFilter/FastFilter/newFilter/hash_images.py --input /home/user/FastFilter/FastFilter/LGarchive/dataset --method dhash --output /home/user/FastFilter/FastFilter/scripts/Inputs/lg_dhash.txt
python3 /home/user/FastFilter/FastFilter/newFilter/hash_images.py --input /home/user/FastFilter/FastFilter/LGarchive/dataset --method ahash --output /home/user/FastFilter/FastFilter/scripts/Inputs/lg_ahash.txt

2) Build

cmake -S /home/user/FastFilter/FastFilter -B /home/user/FastFilter/FastFilter/build -DCMAKE_BUILD_TYPE=Release
cmake --build /home/user/FastFilter/FastFilter/build --target measure_newfilter_perf measure_newfilter_built measure_newfilter_fpp -j"$(nproc)"

3) Run all 6 combinations

cd /home/user/FastFilter/FastFilter/build
for dataset in columbia lg; do
  for method in phash dhash ahash; do
    export SIMDUP_HASH_FILE=/home/user/FastFilter/FastFilter/scripts/Inputs/${dataset}_${method}.txt
    export SIMDUP_SHUFFLE=1

    rm -f ../scripts/Inputs/SimHash-4x16-OR \
          ../scripts/Inputs/SimHash-4x16-OR-hitrate \
          ../scripts/Inputs/SimHash-4x16-OR-fill \
          ../scripts/build-newfilter.csv \
          ../scripts/fpp_table_newfilter.csv

    taskset -c 2 ./measure_newfilter_perf
    taskset -c 2 ./measure_newfilter_built
    taskset -c 2 ./measure_newfilter_fpp

    python3 ../newFilter/plot_results.py --outdir ../scripts

    outdir=../scripts/results_${dataset}_${method}
    mkdir -p "$outdir"
    mv ../scripts/newfilter-*.pdf "$outdir"/
    cp ../scripts/Inputs/SimHash-4x16-OR* "$outdir"/
    cp ../scripts/build-newfilter.csv "$outdir/build-newfilter-${dataset}-${method}.csv"
    cp ../scripts/fpp_table_newfilter.csv "$outdir/fpp_table_newfilter-${dataset}-${method}.csv"
  done
done

Summary plots (3 hashes per dataset):

python3 /home/user/FastFilter/FastFilter/newFilter/plot_summary.py --outdir /home/user/FastFilter/FastFilter/scripts

newFilter outputs

  • Throughput raw data: scripts/Inputs/SimHash-4x16-OR
  • Query hit-rate raw data: scripts/Inputs/SimHash-4x16-OR-hitrate
  • Fill/occupancy raw data: scripts/Inputs/SimHash-4x16-OR-fill
  • Build/FPP summaries: scripts/build-newfilter.csv, scripts/fpp_table_newfilter.csv
  • Plotted PDFs: scripts/newfilter-throughput.pdf, scripts/newfilter-hitrate.pdf, scripts/newfilter-realdata-ratio.pdf, scripts/newfilter-items.pdf, scripts/newfilter-occupancy.pdf

Legacy Prefix-Filter (original)

The original Prefix-Filter benchmark targets remain:

  1. measure_perf
  2. measure_build
  3. measure_fpp

Example build/run:

t="measure_perf"; time cmake --build ./ --target $t -j 20 && time taskset -c 2 ./$t

Credits

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages