ARK-Builders / arklib

Core of the programs in ARK family
MIT License
1 stars 10 forks source link

Benchmark `crc32` and `blake3` hash functions #65

Closed kirillt closed 8 months ago

kirillt commented 9 months ago

We use crc32fast crate to generate ResourceId. It was one of the fastest hash functions 3 years ago, when blake3 was invented.

Official metrics:

Let's create a small benchmark to compare them in same environment, with same parameters.

Even if blake3 is same performant as crc32, it would be worth updating arklib, because blake3 is cryptographic hash function and it means no collisions in the index.

kirillt commented 9 months ago

Different parameters and different cores numbers should be tested in the benchmark.

kirillt commented 9 months ago

This benchmark presents different results:

Hash function MiB/sec cycl./hash cycl./map size Quality problems blake3_c 1288.84 357.69 582.89 (6) no 32bit portability crc32 383.12 134.21 257.50 (11) 422 insecure, 8590x collisions, distrib, PerlinNoise crc32_hw 6244.38 41.23 226.80 (2) 653 insecure, 100% bias, collisions, distrib, BIC, machine-specific (SSE4.2/NEON) crc32_hw1 7569.29 49.07 233.75 (3) 671 insecure, 100% bias, collisions, distrib, BIC, machine-specific (x86 SSE4.2) crc64_hw 6143.62 40.48 223.13 (2) 652 insecure, 100% bias, collisions, distrib, BIC, machine-specific (SSE4.2/NEON)

kirillt commented 8 months ago