Skip to content

Hash functions and CountHashTab#727

Open
lekcyjna123 wants to merge 5 commits intokuznia-rdzeni:masterfrom
lekcyjna123:lekcyjna/hash
Open

Hash functions and CountHashTab#727
lekcyjna123 wants to merge 5 commits intokuznia-rdzeni:masterfrom
lekcyjna123:lekcyjna/hash

Conversation

@lekcyjna123
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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