]> git.ipfire.org Git - thirdparty/zlib-ng.git/commit
Improve SSE2 slide hash performance
authorAdam Stylinski <kungfujesus06@gmail.com>
Mon, 24 Jan 2022 04:32:46 +0000 (23:32 -0500)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Tue, 15 Mar 2022 17:32:49 +0000 (18:32 +0100)
commitff554565c09ee52e7503d817e26ce090ac0cf5c3
tree0b3826c660f02fd30e014011fa93e3d87290cc3a
parent87b4a35b7a71fd34542dd2ca75c54bd0b7000385
Improve SSE2 slide hash performance

At least on pre-nehalem CPUs, we get a > 50% improvement. This is
mostly due to the fact that we're opportunistically doing aligned loads
instead of unaligned loads.  This is something that is very likely to be
possible, given that the deflate stream initialization uses the zalloc
function, which most libraries don't override.  Our allocator aligns to
64 byte boundaries, meaning we can do aligned loads on even AVX512 for
the zstream->prev and zstream->head pointers. However, only pre-nehalem
CPUs _actually_ benefit from explicitly aligned load instructions.

The other thing being done here is we're unrolling the loop by a factor
of 2 so that we can get a tiny bit more ILP.  This improved performance
by another 5%-7% gain.
arch/x86/slide_hash_sse2.c