Unroll iterate loops.

name                      old speed      new speed      delta
puffs_adler32_10k/clang   2.12GB/s ± 1%  2.42GB/s ± 1%  +14.24%  (p=0.008 n=5+5)
puffs_adler32_100k/clang  2.12GB/s ± 3%  2.43GB/s ± 0%  +14.29%  (p=0.008 n=5+5)
mimic_adler32_10k/clang   2.93GB/s ± 2%  2.96GB/s ± 0%     ~     (p=0.310 n=5+5)
mimic_adler32_100k/clang  2.89GB/s ± 2%  2.91GB/s ± 0%     ~     (p=1.000 n=5+5)
puffs_adler32_10k/gcc     2.17GB/s ± 1%  3.23GB/s ± 0%  +48.59%  (p=0.008 n=5+5)
puffs_adler32_100k/gcc    2.18GB/s ± 1%  3.23GB/s ± 0%  +48.34%  (p=0.008 n=5+5)
mimic_adler32_10k/gcc     2.97GB/s ± 0%  2.96GB/s ± 1%     ~     (p=1.000 n=5+5)
mimic_adler32_100k/gcc    2.91GB/s ± 1%  2.91GB/s ± 1%     ~     (p=0.548 n=5+5)
This commit is contained in:
Nigel Tao committed 2017-10-20 17:28:21 +11:00
1 parent b024cb1d8c
commit 245e3ec7b9
6 files changed
+94 -19

No files matched your search

+29 -2
View File
@@ -2437,8 +2437,35 @@ uint32_t puffs_flate_adler32_update(puffs_flate_adler32* self,
{
puffs_base_slice_u8 i_slice_p = a_x;
uint8_t* v_p = i_slice_p.ptr;
uint8_t* i_end_p = i_slice_p.ptr + i_slice_p.len;
while (v_p < i_end_p) {
uint8_t* i_end0_p = i_slice_p.ptr + (i_slice_p.len / 8) * 8;
while (v_p < i_end0_p) {
v_s1 += ((uint32_t)(*v_p));
v_s2 += v_s1;
v_p++;
v_s1 += ((uint32_t)(*v_p));
v_s2 += v_s1;
v_p++;
v_s1 += ((uint32_t)(*v_p));
v_s2 += v_s1;
v_p++;
v_s1 += ((uint32_t)(*v_p));
v_s2 += v_s1;
v_p++;
v_s1 += ((uint32_t)(*v_p));
v_s2 += v_s1;
v_p++;
v_s1 += ((uint32_t)(*v_p));
v_s2 += v_s1;
v_p++;
v_s1 += ((uint32_t)(*v_p));
v_s2 += v_s1;
v_p++;
v_s1 += ((uint32_t)(*v_p));
v_s2 += v_s1;
v_p++;
}
uint8_t* i_end1_p = i_slice_p.ptr + i_slice_p.len;
while (v_p < i_end1_p) {
v_s1 += ((uint32_t)(*v_p));
v_s2 += v_s1;
v_p++;