skeeto / hash-prospector

Automated integer hash function discovery
The Unlicense
672 stars 27 forks source link

modified `exact_bias32` to use `omp parallel for reduction` #11

Open camel-cdr opened 3 years ago

camel-cdr commented 3 years ago

I simplified the exact_bias32 implementation using omp parallel for reduction instead of doing the reduction manually.

I haven't tested this extensively, but I did compare two complete ./prospector -e -E -4 -l tests/murmurhash3_finalizer32.so runs and found that omp parallel for reduction was a bit faster (original:~3 ns / hash vs new: ~2.8 ns / hash).

Note that the array reduction feature was added in OpenMP 4.5, which was released in 2016, so it might be too new to warrant the change.

skeeto commented 3 years ago

Interesting, thanks! I didn't know OpenMP had this particular feature. As you pointed out, this is still fairly new-ish, so I'm going to hold onto this update for now, but I'm glad to have it (and learned about it).