mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Tweak how std/lzw yields "short read"
This fixes a std/lzw performance regression (for gcc only, not clang),
introduced in 33a4557 "Collect GIF's LZW data into larger batches".
This commit restores the std/lzw performance, but it also makes the
std/gif benchmarks worse. As LZW is not really used outside of GIF, this
commit will immediately be followed by a rollback, but it is committed
anyway so that we can refer to these numbers in the git log.
name old speed new speed delta
wuffs_lzw_decode_20k/clang 213MB/s ± 1% 205MB/s ± 1% -3.90% (p=0.008 n=5+5)
wuffs_lzw_decode_100k/clang 359MB/s ± 1% 351MB/s ± 0% -2.14% (p=0.008 n=5+5)
wuffs_lzw_decode_20k/gcc 189MB/s ± 0% 229MB/s ± 0% +21.37% (p=0.008 n=5+5)
wuffs_lzw_decode_100k/gcc 223MB/s ± 0% 390MB/s ± 1% +74.77% (p=0.016 n=4+5)
wuffs_gif_decode_1k_bw/clang 225MB/s ± 1% 229MB/s ± 0% +1.52% (p=0.008 n=5+5)
wuffs_gif_decode_1k_color/clang 118MB/s ± 1% 118MB/s ± 1% ~ (p=0.841 n=5+5)
wuffs_gif_decode_10k_bgra/clang 569MB/s ± 0% 565MB/s ± 0% -0.66% (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/clang 152MB/s ± 1% 150MB/s ± 1% -1.25% (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang 454MB/s ± 1% 459MB/s ± 0% +1.05% (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/clang 179MB/s ± 0% 178MB/s ± 1% ~ (p=0.222 n=5+5)
wuffs_gif_decode_1000k/clang 180MB/s ± 1% 181MB/s ± 0% +0.79% (p=0.016 n=5+5)
wuffs_gif_decode_anim_screencap/clang 951MB/s ± 0% 958MB/s ± 0% +0.66% (p=0.008 n=5+5)
wuffs_gif_decode_1k_bw/gcc 238MB/s ± 0% 240MB/s ± 0% +0.91% (p=0.008 n=5+5)
wuffs_gif_decode_1k_color/gcc 130MB/s ± 1% 127MB/s ± 0% -2.25% (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc 537MB/s ± 1% 518MB/s ± 2% -3.59% (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/gcc 164MB/s ± 1% 157MB/s ± 1% -4.43% (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc 454MB/s ± 2% 447MB/s ± 0% ~ (p=0.095 n=5+5)
wuffs_gif_decode_100k_realistic/gcc 186MB/s ± 1% 179MB/s ± 1% -3.28% (p=0.008 n=5+5)
wuffs_gif_decode_1000k/gcc 188MB/s ± 1% 182MB/s ± 0% -3.06% (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/gcc 971MB/s ± 1% 941MB/s ± 0% -3.11% (p=0.008 n=5+5)
This commit is contained in:
1 parent
6c5d7806bf
commit
ecb399508c
2 files changed
+9
-7
No files matched your search
@@ -7176,7 +7176,7 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
||||
v_n_bits |= 24;
|
||||
} else {
|
||||
while (true) {
|
||||
while (((uint64_t)(io1_a_src - iop_a_src)) <= 0) {
|
||||
if (((uint64_t)(io1_a_src - iop_a_src)) <= 0) {
|
||||
if (v_j > 0) {
|
||||
self->private_impl.f_flush_j = v_j;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
|
||||
@@ -7185,7 +7185,8 @@ wuffs_lzw__decoder__decode(wuffs_lzw__decoder* self,
|
||||
goto suspend;
|
||||
}
|
||||
v_j = 0;
|
||||
} else {
|
||||
}
|
||||
while (((uint64_t)(io1_a_src - iop_a_src)) <= 0) {
|
||||
status = wuffs_base__suspension__short_read;
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(2);
|
||||
}
|
||||
|
||||
@@ -81,15 +81,16 @@ pub func decoder.decode!??(dst base.io_writer, src base.io_reader) {
|
||||
pre n_bits < 12,
|
||||
post n_bits >= width,
|
||||
{
|
||||
while args.src.available() <= 0,
|
||||
inv n_bits < 12,
|
||||
post args.src.available() >= 1,
|
||||
{
|
||||
if args.src.available() <= 0 {
|
||||
if j > 0 {
|
||||
this.flush_j = j
|
||||
this.flush!??(dst:args.dst)
|
||||
j = 0
|
||||
} else {
|
||||
}
|
||||
while args.src.available() <= 0,
|
||||
inv n_bits < 12,
|
||||
post args.src.available() > 0,
|
||||
{
|
||||
yield base."$short read"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user