Re-organize flate Huffman decoder table bits.

Benchmarks are mixed, but it seems conceptually cleaner to arrange the
bits in the order that they're examined.

name                           old speed     new speed     delta
puffs_flate_decode_1k/clang    125MB/s ± 0%  123MB/s ± 1%  -1.91%  (p=0.008 n=5+5)
puffs_flate_decode_10k/clang   163MB/s ± 1%  157MB/s ± 0%  -3.55%  (p=0.008 n=5+5)
puffs_flate_decode_100k/clang  175MB/s ± 0%  173MB/s ± 0%  -0.75%  (p=0.016 n=4+5)
puffs_flate_decode_1k/gcc      127MB/s ± 0%  130MB/s ± 0%  +2.14%  (p=0.008 n=5+5)
puffs_flate_decode_10k/gcc     142MB/s ± 1%  149MB/s ± 0%  +4.99%  (p=0.016 n=5+4)
puffs_flate_decode_100k/gcc    162MB/s ± 2%  168MB/s ± 0%  +3.66%  (p=0.016 n=5+4)
This commit is contained in:
Nigel Tao committed 2017-10-06 13:07:49 +11:00
1 parent cec4e30245
commit cf6b1be5b5
5 files changed
+71 -68

No files matched your search

+5 -5
View File
@@ -463,19 +463,19 @@ void test_puffs_flate_table_redirect() {
uint32_t got;
uint32_t want;
got = dec.private_impl.f_huffs[0][0x017F];
want = 0x80020039;
want = 0x10020039;
if (got != want) {
FAIL("huffs[0][0x017F]: got 0x%08" PRIX32 ", want 0x%08" PRIX32, got, want);
return;
}
got = dec.private_impl.f_huffs[0][0x00FF];
want = 0x80020839;
want = 0x10020839;
if (got != want) {
FAIL("huffs[0][0x00FF]: got 0x%08" PRIX32 ", want 0x%08" PRIX32, got, want);
return;
}
got = dec.private_impl.f_huffs[0][0x01FF];
want = 0x80021049;
want = 0x10021049;
if (got != want) {
FAIL("huffs[0][0x01FF]: got 0x%08" PRIX32 ", want 0x%08" PRIX32, got, want);
return;
@@ -483,8 +483,8 @@ void test_puffs_flate_table_redirect() {
// The first 2nd-level table should look like wants.
const uint32_t wants[8] = {
0x40000801, 0x40000903, 0x40000801, 0x40000B03,
0x40000801, 0x40000A03, 0x40000801, 0x40000C03,
0x80000801, 0x80000903, 0x80000801, 0x80000B03,
0x80000801, 0x80000A03, 0x80000801, 0x80000C03,
};
for (i = 0; i < 8; i++) {
got = dec.private_impl.f_huffs[0][0x0200 + i];