Tweak std/deflate decode_huffman_fast asserts

wuffs_deflate_decode_1k_full_init/clang9         95.0MB/s ± 0%  92.9MB/s ± 0%   -2.25%  (p=0.008 n=5+5)
wuffs_deflate_decode_1k_part_init/clang9          108MB/s ± 0%   108MB/s ± 0%   +0.34%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_full_init/clang9         141MB/s ± 0%   165MB/s ± 1%  +16.77%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_part_init/clang9         143MB/s ± 0%   169MB/s ± 0%  +17.73%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_just_one_read/clang9    185MB/s ± 0%   181MB/s ± 0%   -2.09%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_many_big_reads/clang9   156MB/s ± 1%   151MB/s ± 0%   -3.12%  (p=0.008 n=5+5)

wuffs_deflate_decode_1k_full_init/gcc10          98.6MB/s ± 0%  97.5MB/s ± 0%   -1.05%  (p=0.016 n=4+5)
wuffs_deflate_decode_1k_part_init/gcc10           112MB/s ± 0%   111MB/s ± 0%   -1.05%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_full_init/gcc10          183MB/s ± 0%   181MB/s ± 1%   -0.73%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k_part_init/gcc10          186MB/s ± 0%   185MB/s ± 0%   -0.80%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_just_one_read/gcc10     213MB/s ± 0%   216MB/s ± 0%   +1.55%  (p=0.008 n=5+5)
wuffs_deflate_decode_100k_many_big_reads/gcc10    174MB/s ± 0%   179MB/s ± 0%   +2.79%  (p=0.008 n=5+5)
This commit is contained in:
Nigel Tao committed 2021-02-02 13:08:21 +11:00
1 parent dc60821826
commit 4848859f97
3 files changed
+18 -15

No files matched your search

+9 -7
View File
@@ -216,18 +216,20 @@ pri func decoder.decode_huffman_fast!(dst: base.io_writer, src: base.io_reader)
continue.loop
}
if ((dist_minus_1 + 1) as base.u64) > args.dst.history_length() {
if (((dist_minus_1 + 1) as base.u64) > args.dst.history_length()) or
((length as base.u64) > args.dst.length()) {
return "#internal error: inconsistent distance"
}
} else {
assert (length as base.u64) <= 258
assert args.dst.length() >= 258
// We can therefore prove:
assert (length as base.u64) <= args.dst.length() via "a <= b: a <= c; c <= b"(c: 258)
}
// Once again, redundant but explicit assertions.
assert ((dist_minus_1 + 1) as base.u64) <= args.dst.history_length()
assert args.dst.length() >= 258
// We can therefore prove:
assert (dist_minus_1 + 1) > 0
assert (length as base.u64) <= 258
assert (length as base.u64) <= args.dst.length() via "a <= b: a <= c; c <= b"(c: 258)
assert ((dist_minus_1 + 1) as base.u64) <= args.dst.history_length()
assert (length as base.u64) <= args.dst.length()
// Copy from args.dst.
args.dst.limited_copy_u32_from_history_fast!(