Remove some suspensions from decode_huffman_fast.

name                           old speed      new speed      delta

puffs_adler32_10k/clang        2.40GB/s ± 3%  2.45GB/s ± 0%   +2.21%  (p=0.000 n=10+10)
puffs_adler32_100k/clang       2.41GB/s ± 1%  2.46GB/s ± 0%   +2.05%  (p=0.000 n=9+10)
puffs_flate_decode_1k/clang     127MB/s ± 1%   137MB/s ± 0%   +7.94%  (p=0.000 n=9+9)
puffs_flate_decode_10k/clang    177MB/s ± 1%   177MB/s ± 0%     ~     (p=0.234 n=9+10)
puffs_flate_decode_100k/clang   205MB/s ± 1%   198MB/s ± 0%   -3.06%  (p=0.000 n=9+10)
puffs_zlib_decode_10k/clang     165MB/s ± 1%   163MB/s ± 0%   -1.12%  (p=0.000 n=9+9)
puffs_zlib_decode_100k/clang    189MB/s ± 0%   182MB/s ± 0%   -3.42%  (p=0.000 n=9+9)

puffs_adler32_10k/gcc          3.26GB/s ± 0%  3.26GB/s ± 0%     ~     (p=0.065 n=9+10)
puffs_adler32_100k/gcc         3.27GB/s ± 0%  3.27GB/s ± 0%     ~     (p=0.173 n=8+10)
puffs_flate_decode_1k/gcc       111MB/s ± 0%   111MB/s ± 1%     ~     (p=0.971 n=10+10)
puffs_flate_decode_10k/gcc      149MB/s ± 0%   142MB/s ± 0%   -4.67%  (p=0.000 n=9+10)
puffs_flate_decode_100k/gcc     160MB/s ± 0%   153MB/s ± 0%   -4.46%  (p=0.000 n=9+9)
puffs_zlib_decode_10k/gcc       128MB/s ± 0%   142MB/s ± 0%  +11.21%  (p=0.000 n=9+9)
puffs_zlib_decode_100k/gcc      137MB/s ± 0%   149MB/s ± 0%   +8.47%  (p=0.000 n=8+8)
This commit is contained in:
Nigel Tao committed 2017-11-06 08:31:03 +11:00
1 parent 5520340d7c
commit bf50d268ae
2 files changed
+13 -37

No files matched your search

+3 -14
View File
@@ -292,6 +292,9 @@ pri func flate_decoder.decode_huffman_fast?(dst writer1, src reader1)() {
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
}
}
@@ -304,20 +307,6 @@ pri func flate_decoder.decode_huffman_fast?(dst writer1, src reader1)() {
// suspension can change the state of this and its fields.
assert false
}
// Copy from the start of this.history, if we wrapped around.
if hlen > 0 {
while true {
n_copied = in.dst.copy_from_slice32(s:this.history[hdist:], length:hlen)
if hlen <= n_copied {
hlen = 0
break
}
hlen -= n_copied
hdist = (hdist + (n_copied & 0x7FFF)) & 0x7FFF
// TODO: "closed for writes" instead?
return suspension "short write"
}
}
if length == 0 {
// No need to copy from in.dst.