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

Hash functions and CountHashTab #727

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

lekcyjna123
Copy link
Contributor

@lekcyjna123 lekcyjna123 commented Aug 31, 2024

Hi,
Here is a pull request which adds hash tables. In particularly:

I am not sure how to test them, so comments are welcome.

Hash functions I test using statistical test to check if they hash into uniform distribution, but sadly for small input data (from range [0,1023]) there is some bias and statistical tests fails... Whats more I am not sure if we want to have tests based on statistics, because this can cause instability.

@lekcyjna123 lekcyjna123 changed the title Add Lookup3 and Sip hashes Hash functions and CountHashTab Sep 1, 2024
@lekcyjna123 lekcyjna123 marked this pull request as ready for review September 1, 2024 14:56
@tilk
Copy link
Member

tilk commented Sep 4, 2024

Whats more I am not sure if we want to have tests based on statistics, because this can cause instability.

We're not supposed to implement some dreamed up hash functions, but some existing ones with established properties. The only thing to test is to compare a hardware implementation to a software one.

Comment on lines +183 to +185
# Check if there is at least as many elements as we put inside (can be more because of aliasing)
assert count["count"] >= sum(map(lambda x: 1, filter(lambda x: x == in_val, input)))
assert count["count"] in self.table_snapshots[-1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very weak test. I believe a constant table which is filled with maximum values would satisfy it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants