Unroll the copy_history32 loop.

name                             old speed      new speed      delta
puffs_flate_decode_1k/clang       127MB/s ± 2%   140MB/s ± 0%  +10.13%  (p=0.000 n=83+95)
puffs_flate_decode_10k/clang      151MB/s ± 1%   166MB/s ± 0%  +10.38%  (p=0.000 n=82+97)
puffs_flate_decode_100k/clang     165MB/s ± 1%   177MB/s ± 0%   +7.42%  (p=0.000 n=89+94)
puffs_flate_decode_1k/gcc         155MB/s ± 2%   153MB/s ± 1%   -1.67%  (p=0.000 n=91+89)
puffs_flate_decode_10k/gcc        146MB/s ± 2%   147MB/s ± 0%   +0.41%  (p=0.000 n=86+83)
puffs_flate_decode_100k/gcc       166MB/s ± 1%   170MB/s ± 0%   +2.34%  (p=0.000 n=88+84)
This commit is contained in:
Nigel Tao committed 2017-07-30 13:36:32 +10:00
1 parent df8772dadf
commit 61c5b40bf6
2 files changed
+15

No files matched your search

+5
View File
@@ -952,6 +952,11 @@ func (g *gen) writeCallSuspendibles(n *a.Expr, depth uint32) error {
g.printf("if (PUFFS_LIKELY((size_t)(%s%d) <= (%swend_%s - %swptr_%s))) {",
tPrefix, temp2, bPrefix, wName, bPrefix, wName)
g.printf("for (; %s%d >= 8; %s%d -= 8) {", tPrefix, temp2, tPrefix, temp2)
for i := 0; i < 8; i++ {
g.printf("*%swptr_%s++ = *%s%d++;\n", bPrefix, wName, tPrefix, temp1)
}
g.writes("}\n")
g.printf("for (; %s%d; %s%d--) { *%swptr_%s++ = *%s%d++; }\n",
tPrefix, temp2, tPrefix, temp2, bPrefix, wName, tPrefix, temp1)
+10
View File
@@ -1026,6 +1026,16 @@ puffs_flate_status puffs_flate_decoder_decode_huffman(
uint8_t* t_7 = b_wptr_dst - t_6;
uint32_t t_8 = (uint32_t)(self->private_impl.scratch);
if (PUFFS_LIKELY((size_t)(t_8) <= (b_wend_dst - b_wptr_dst))) {
for (; t_8 >= 8; t_8 -= 8) {
*b_wptr_dst++ = *t_7++;
*b_wptr_dst++ = *t_7++;
*b_wptr_dst++ = *t_7++;
*b_wptr_dst++ = *t_7++;
*b_wptr_dst++ = *t_7++;
*b_wptr_dst++ = *t_7++;
*b_wptr_dst++ = *t_7++;
*b_wptr_dst++ = *t_7++;
}
for (; t_8; t_8--) {
*b_wptr_dst++ = *t_7++;
}