ostafen / smart

String Matching Algorithms Research Tool
https://smart-tool.github.io/smart/
GNU General Public License v3.0
4 stars 2 forks source link

Record test results #75

Closed nishihatapalmer closed 1 year ago

nishihatapalmer commented 1 year ago

This records test results in a tested_algos file, by hashing the algorithm shared object with its name.

It detects test status when benchmarking and flags any algorithms that haven't passed tests.

nishihatapalmer commented 1 year ago

It uses a hash called FNV, or the Fowler–Noll–Vo hash function.

https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function

It is extremely simple to compute, just relying on XOR and multiplications mod 64 bits, with some large prime numbers. It is not "secure", but it is sufficient I think to compute a 64 bit hash digest of the passing algorithms.

We use the 1a variant, as some claim it to have slightly better dispersion.

Due to birthday paradox, a 50% chance of a collision in a 64 bit hash value between any two pairs is roughly 1 in 32 bits, or about 1 in 4 billion. Those pairs have to exist on the same machine in order to trigger a collision. So the chance of a failing algorithm colliding with a passing hash result is extremely minimal. The consequence of a collision is that an algorithm which has not passed testing would be flagged as passing testing.