From 6af3852fa8b45557e3668697312ebd006cd8ae1d Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Thu, 3 Aug 2017 10:53:41 +1000 Subject: [PATCH] Change the back-copy unroll count from 8 to 3. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We're possibly overfitting now on the very small benchmark corpus (3 files), but we can test on larger corpuses later. Algorithmically, it does match what zlib does. name old speed new speed delta puffs_flate_decode_1k/clang 188MB/s ± 0% 191MB/s ± 1% +1.55% (p=0.008 n=5+5) puffs_flate_decode_10k/clang 242MB/s ± 2% 277MB/s ± 1% +14.72% (p=0.008 n=5+5) puffs_flate_decode_100k/clang 273MB/s ± 1% 315MB/s ± 1% +15.63% (p=0.008 n=5+5) puffs_flate_decode_1k/gcc 187MB/s ± 0% 194MB/s ± 2% +3.56% (p=0.008 n=5+5) puffs_flate_decode_10k/gcc 242MB/s ± 0% 279MB/s ± 1% +15.29% (p=0.016 n=5+4) puffs_flate_decode_100k/gcc 288MB/s ± 1% 315MB/s ± 0% +9.29% (p=0.008 n=5+5) Note that these are benchmark numbers for an 'ideal', hand-written C implementation, not for Puffs' generated C code. --- script/puffs-flate-decoder-decode-huffman.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/script/puffs-flate-decoder-decode-huffman.c b/script/puffs-flate-decoder-decode-huffman.c index fbcc221e..d4f16088 100644 --- a/script/puffs-flate-decoder-decode-huffman.c +++ b/script/puffs-flate-decoder-decode-huffman.c @@ -235,12 +235,7 @@ outer_loop: } uint8_t* pback = pdst - distance; - for (; length >= 8; length -= 8) { - *pdst++ = *pback++; - *pdst++ = *pback++; - *pdst++ = *pback++; - *pdst++ = *pback++; - *pdst++ = *pback++; + for (; length >= 3; length -= 3) { *pdst++ = *pback++; *pdst++ = *pback++; *pdst++ = *pback++;