mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
Remove some suspensions from decode_huffman_fast.
name old speed new speed delta puffs_adler32_10k/clang 2.45GB/s ± 2% 2.40GB/s ± 3% -1.87% (p=0.001 n=9+10) puffs_adler32_100k/clang 2.46GB/s ± 0% 2.41GB/s ± 1% -2.08% (p=0.000 n=8+9) puffs_flate_decode_1k/clang 125MB/s ± 0% 127MB/s ± 1% +1.53% (p=0.000 n=9+9) puffs_flate_decode_10k/clang 168MB/s ± 0% 177MB/s ± 1% +5.59% (p=0.000 n=10+9) puffs_flate_decode_100k/clang 193MB/s ± 0% 205MB/s ± 1% +6.20% (p=0.000 n=9+9) puffs_zlib_decode_10k/clang 157MB/s ± 0% 165MB/s ± 1% +5.00% (p=0.000 n=9+9) puffs_zlib_decode_100k/clang 179MB/s ± 0% 189MB/s ± 0% +5.69% (p=0.000 n=8+9) puffs_adler32_10k/gcc 3.26GB/s ± 0% 3.26GB/s ± 0% -0.14% (p=0.000 n=10+9) puffs_adler32_100k/gcc 3.27GB/s ± 0% 3.27GB/s ± 0% -0.09% (p=0.000 n=9+8) puffs_flate_decode_1k/gcc 122MB/s ± 0% 111MB/s ± 0% -9.40% (p=0.000 n=10+10) puffs_flate_decode_10k/gcc 176MB/s ± 0% 149MB/s ± 0% -15.45% (p=0.000 n=10+9) puffs_flate_decode_100k/gcc 199MB/s ± 0% 160MB/s ± 0% -19.51% (p=0.000 n=10+9) puffs_zlib_decode_10k/gcc 168MB/s ± 0% 128MB/s ± 0% -24.01% (p=0.000 n=10+9) puffs_zlib_decode_100k/gcc 187MB/s ± 0% 137MB/s ± 0% -26.84% (p=0.000 n=9+8)
This commit is contained in:
1 parent
e7c14dfe63
commit
5520340d7c
2 files changed
+8
-17
No files matched your search
+3
-9
@@ -2329,23 +2329,17 @@ static puffs_flate__status puffs_flate__flate_decoder__decode_huffman_fast(
|
||||
goto label_0_continue;
|
||||
}
|
||||
}
|
||||
v_n_copied = puffs_base__writer1__copy_from_history32(
|
||||
puffs_base__writer1__copy_from_history32(
|
||||
&b_wptr_dst, a_dst.private_impl.mark, b_wend_dst, v_distance,
|
||||
v_length);
|
||||
if (v_length <= v_n_copied) {
|
||||
v_length = 0;
|
||||
goto label_3_break;
|
||||
}
|
||||
v_length -= v_n_copied;
|
||||
status = PUFFS_FLATE__SUSPENSION_SHORT_WRITE;
|
||||
PUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(5);
|
||||
goto label_3_break;
|
||||
}
|
||||
label_3_break:;
|
||||
}
|
||||
label_0_break:;
|
||||
while (v_n_bits >= 8) {
|
||||
v_n_bits -= 8;
|
||||
PUFFS_BASE__COROUTINE_SUSPENSION_POINT(6);
|
||||
PUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
|
||||
if (b_rptr_src == b_rstart_src) {
|
||||
status = PUFFS_FLATE__ERROR_INVALID_I_O_OPERATION;
|
||||
goto exit;
|
||||
|
||||
@@ -255,6 +255,9 @@ pri func flate_decoder.decode_huffman_fast?(dst writer1, src reader1)() {
|
||||
n_bits -= table_entry_n_bits
|
||||
|
||||
var n_copied u32
|
||||
// The "while true { etc; break }" is a redundant version of "etc", but
|
||||
// its presence minimizes the diff between decode_huffman_fast and
|
||||
// decode_huffman_slow.
|
||||
while true {
|
||||
// Copy from this.history.
|
||||
if (distance as u64) > in.dst.since_mark().length() {
|
||||
@@ -323,14 +326,8 @@ pri func flate_decoder.decode_huffman_fast?(dst writer1, src reader1)() {
|
||||
}
|
||||
|
||||
// Copy from in.dst.
|
||||
n_copied = in.dst.copy_from_history32(distance:distance, length:length)
|
||||
if length <= n_copied {
|
||||
length = 0
|
||||
break
|
||||
}
|
||||
length -= n_copied
|
||||
// TODO: "closed for writes" instead?
|
||||
return suspension "short write"
|
||||
in.dst.copy_from_history32(distance:distance, length:length)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user