Hello, This patch enables more compiler autovectorization for the checksum calculations. This code is particularly well suited for autovectorization, so just adding pg_attribute_target and some simple dynamic dispatch logic we can get improved vectorization. This gives about a 2x speedup in a synthetic benchmark for pg_checksum, which is also included as a seperate patch file.
Additionally, another 2x performance increase in the synthetic benchmark with AVX2 can be obtained if N_SUMS was changed to 64. However, this would change the results of the checksum. This isn't included in this patch, but I think it is worth considering for the future One additional factor, without explicitly passing some optimization flag like -O2 the makefile build won't autovectorize any of the code. However, the meson based build does this automatically.
v1-0001-Enable-autovectorizing-pg_checksum_block.patch
Description: Binary data
v1-0002-Benchmark-code-for-postgres-checksums.patch
Description: Binary data