mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 08:47:28 +01:00
Remove some suspensions from decode_huffman_fast.
name old speed new speed delta puffs_adler32_10k/clang 2.45GB/s ± 0% 2.45GB/s ± 0% -0.08% (p=0.006 n=10+9) puffs_adler32_100k/clang 2.46GB/s ± 0% 2.45GB/s ± 0% -0.12% (p=0.000 n=10+9) puffs_flate_decode_1k/clang 137MB/s ± 0% 133MB/s ± 0% -2.71% (p=0.000 n=9+9) puffs_flate_decode_10k/clang 177MB/s ± 0% 181MB/s ± 0% +2.22% (p=0.000 n=10+9) puffs_flate_decode_100k/clang 198MB/s ± 0% 204MB/s ± 0% +3.04% (p=0.000 n=10+10) puffs_zlib_decode_10k/clang 163MB/s ± 0% 168MB/s ± 0% +3.23% (p=0.000 n=9+10) puffs_zlib_decode_100k/clang 182MB/s ± 0% 189MB/s ± 0% +3.56% (p=0.000 n=9+10) puffs_adler32_10k/gcc 3.26GB/s ± 0% 3.26GB/s ± 0% ~ (p=0.280 n=10+10) puffs_adler32_100k/gcc 3.27GB/s ± 0% 3.27GB/s ± 0% ~ (p=0.075 n=10+10) puffs_flate_decode_1k/gcc 111MB/s ± 1% 130MB/s ± 0% +17.19% (p=0.000 n=10+10) puffs_flate_decode_10k/gcc 142MB/s ± 0% 203MB/s ± 0% +43.11% (p=0.000 n=10+9) puffs_flate_decode_100k/gcc 153MB/s ± 0% 241MB/s ± 0% +57.62% (p=0.000 n=9+8) puffs_zlib_decode_10k/gcc 142MB/s ± 0% 188MB/s ± 0% +32.47% (p=0.000 n=9+9) puffs_zlib_decode_100k/gcc 149MB/s ± 0% 223MB/s ± 0% +50.03% (p=0.000 n=8+9)
This commit is contained in:
1 parent
bf50d268ae
commit
ccdd74a17f
2 files changed
+17
-39
No files matched your search
@@ -280,32 +280,20 @@ pri func flate_decoder.decode_huffman_fast?(dst writer1, src reader1)() {
|
||||
// start copying from.
|
||||
hdist = (this.history_index - hdist) & 0x7FFF
|
||||
|
||||
// Copy from hdist to the end of this.history.
|
||||
// Copy from hdist to the end of this.history, and then
|
||||
// possibly wrap around the this.history ringbuffer.
|
||||
//
|
||||
// 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 {
|
||||
n_copied = in.dst.copy_from_slice32(s:this.history[hdist:], length:hlen)
|
||||
if hlen <= n_copied {
|
||||
hlen = 0
|
||||
break
|
||||
}
|
||||
if n_copied > 0 {
|
||||
hlen -= n_copied
|
||||
hdist = (hdist ~+ n_copied) & 0x7FFF
|
||||
if hdist == 0 {
|
||||
// Wrap around the this.history ringbuffer.
|
||||
if hlen > 0 {
|
||||
in.dst.copy_from_slice32(s:this.history[:], length:hlen)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
// TODO: "closed for writes" instead?
|
||||
return suspension "short write"
|
||||
// TODO: this "assert false" should be a compiler error.
|
||||
// This might mean differentiating "return" and "raise".
|
||||
//
|
||||
// TODO: invalidate this-related facts because the
|
||||
// suspension can change the state of this and its fields.
|
||||
assert false
|
||||
hlen -= n_copied
|
||||
in.dst.copy_from_slice32(s:this.history[:], length:hlen)
|
||||
break
|
||||
}
|
||||
|
||||
if length == 0 {
|
||||
|
||||
Reference in new issue
Block a user