sichash

A (Minimal) Perfect Hash Function based on irregular cuckoo hashing, retrieval, and overloading.

https://github.com/bytehamster/sichash

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.4%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

A (Minimal) Perfect Hash Function based on irregular cuckoo hashing, retrieval, and overloading.

Basic Info
  • Host: GitHub
  • Owner: ByteHamster
  • License: gpl-3.0
  • Language: C++
  • Default Branch: main
  • Homepage:
  • Size: 2.21 MB
Statistics
  • Stars: 19
  • Watchers: 6
  • Forks: 1
  • Open Issues: 0
  • Releases: 1
Created over 3 years ago · Last pushed 8 months ago
Metadata Files
Readme License Citation

README.md

SicHash

License: GPL v3 Build status

A perfect hash function (PHF) maps a set S of n keys to the first m integers without collisions. It is called minimal perfect (MPHF) if m=n. Perfect hash functions have applications in databases, bioinformatics, and as a building block of various space-efficient data structures.

SicHash is a (minimal) perfect hash function based on irregular cuckoo hashing, retrieval, and overloading. Each input key has a small number of choices for output positions. Using cuckoo hashing, SicHash determines a mapping from each key to one of its choices, such that there are no collisions between keys. It then stores the mapping from keys to their candidate index space-efficiently using the BuRR retrieval data structure.

SicHash offers a very good trade-off between construction performance, query performance, and space consumption.

Library Usage

Clone this repo and add the following to your CMakeLists.txt. Note that the repo has submodules, so either use git clone --recursive or git submodule update --init --recursive.

add_subdirectory(path/to/SicHash) target_link_libraries(YourTarget PRIVATE SicHash)

Constructing a SicHash perfect hash function is then straightforward:

cpp std::vector<std::string> keys = {"abc", "def", "123", "456"}; sichash::SicHashConfig config; sichash::SicHash<true> hashFunc(keys, config); std::cout << hashFunc("abc") << std::endl;

Construction Performance

Plots preview

Query Performance

Plots preview

Reproducing Experiments

This repository contains the source code and our reproducibility artifacts for the benchmarks specific to SicHash. Benchmarks that compare SicHash to competitors are available in a different repository: https://github.com/ByteHamster/MPHF-Experiments

We provide an easy to use Docker image to quickly reproduce our results. Alternatively, you can look at the Dockerfile to see all libraries, tools, and commands necessary to compile SicHash.

Building the Docker Image

Run the following command to build the Docker image. Building the image takes about 5 minutes, as some packages (including LaTeX for the plots) have to be installed.

bash docker build -t sichash --no-cache .

Some compiler warnings (red) are expected when building competitors and will not prevent building the image or running the experiments. Please ignore them!

Running the Experiments

Due to the long total running time of all experiments in our paper, we provide run scripts for a slightly simplified version of the experiments. They run fewer iterations and output fewer data points.

You can modify the benchmarks scripts in scripts/dockerVolume if you want to change the number of runs or data points. This does not require the Docker image to recompile. Different experiments can be started by using the following command:

bash docker run --interactive --tty -v "$(pwd)/scripts/dockerVolume:/opt/dockerVolume" sichash /opt/dockerVolume/figure-1.sh

The number also refers to the figure in the paper.

| Figure in paper | Launch command | Estimated runtime | | :-------------- | :---------------------------- | :----------------- | | 1 | /opt/dockerVolume/figure-1.sh | 10 minutes |

The resulting plots can be found in scripts/dockerVolume and are called figure-<number>.pdf. More experiments comparing SicHash with competitors can be found in a different repository: https://github.com/ByteHamster/MPHF-Experiments

License

This code is licensed under the GPLv3. If you use the project in an academic context or publication, please cite our paper:

@inproceedings{lehmann2023sichash, author = {Hans{-}Peter Lehmann and Peter Sanders and Stefan Walzer}, title = {SicHash - Small Irregular Cuckoo Tables for Perfect Hashing}, booktitle = {{ALENEX}}, pages = {176--189}, publisher = {{SIAM}}, year = {2023}, doi = {10.1137/1.9781611977561.CH15} }

Owner

  • Login: ByteHamster
  • Kind: user
  • Location: Germany
  • Company: Karlsruhe Institute of Technology

I'm a PhD student at Karlsruhe Institute of Technology. In my freetime, I maintain AntennaPod and contribute to other projects like K-9 Mail and Baikal Server.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software in an academic context or publication, please cite it as below."
authors:
- family-names: "Lehmann"
  given-names: "Hans-Peter"
  orcid: "https://orcid.org/0000-0002-0474-1805"
- family-names: "Sanders"
  given-names: "Peter"
  orcid: "https://orcid.org/0000-0003-3330-9349"
- family-names: "Walzer"
  given-names: "Stefan"
  orcid: "https://orcid.org/0000-0002-6477-0106"
title: "SicHash - Small Irregular Cuckoo Tables for Perfect Hashing"
preferred-citation:
  type: conference-paper
  title: "SicHash - Small Irregular Cuckoo Tables for Perfect Hashing"
  authors:
    - family-names: "Lehmann"
      given-names: "Hans-Peter"
      orcid: "https://orcid.org/0000-0002-0474-1805"
    - family-names: "Sanders"
      given-names: "Peter"
      orcid: "https://orcid.org/0000-0003-3330-9349"
    - family-names: "Walzer"
      given-names: "Stefan"
      orcid: "https://orcid.org/0000-0002-6477-0106"
  doi: "10.1137/1.9781611977561.CH15"
  journal: "ALENEX"
  year: 2023

GitHub Events

Total
  • Issues event: 4
  • Watch event: 2
  • Delete event: 1
  • Issue comment event: 4
  • Push event: 11
  • Fork event: 1
  • Create event: 1
Last Year
  • Issues event: 4
  • Watch event: 2
  • Delete event: 1
  • Issue comment event: 4
  • Push event: 11
  • Fork event: 1
  • Create event: 1

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 179
  • Total Committers: 1
  • Avg Commits per committer: 179.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 12
  • Committers: 1
  • Avg Commits per committer: 12.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
ByteHamster i****o@b****m 179
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 5
  • Total pull requests: 0
  • Average time to close issues: 2 months
  • Average time to close pull requests: N/A
  • Total issue authors: 4
  • Total pull request authors: 0
  • Average comments per issue: 1.8
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 0
  • Average time to close issues: about 22 hours
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 0
  • Average comments per issue: 2.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • yhhshb (2)
  • vigna (1)
  • RagnarGrootKoerkamp (1)
  • V0ldek (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/build.yml actions
  • actions/checkout v2 composite
Dockerfile docker
  • ubuntu 22.04 build