mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 16:55:11 +01:00
std/lzma: add decoder.decode_bitstream_fast
name old speed new speed delta wuffs_lzma_decode_100k/clang14 52.7MB/s ± 0% 54.8MB/s ± 1% +4.00% (p=0.008 n=5+5) wuffs_lzma_decode_100k/gcc12 50.3MB/s ± 1% 56.8MB/s ± 0% +12.93% (p=0.008 n=5+5) $ time example-mzcat < linux-6.8.2.tar.xz > /dev/null Before: user 0m9.725s After: user 0m8.409s
This commit is contained in:
1 parent
f5bb519320
commit
9958d6c520
4 files changed
+1998
-7
No files matched your search
@@ -18,6 +18,7 @@ pub status "#truncated input"
|
||||
pub status "#unsupported decoded length"
|
||||
pub status "#unsupported properties"
|
||||
|
||||
pri status "#internal error: inconsistent I/O"
|
||||
pri status "#internal error: inconsistent dictionary state"
|
||||
|
||||
pub const DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
@@ -62,6 +63,8 @@ pub struct decoder? implements base.io_transformer(
|
||||
|
||||
allow_non_zero_initial_byte : base.bool,
|
||||
|
||||
end_of_chunk : base.bool,
|
||||
|
||||
stashed_bytes : array[2] base.u8, // 0 is prev_byte, 1 is match_byte.
|
||||
stashed_bits : base.u32,
|
||||
stashed_range : base.u32,
|
||||
@@ -558,7 +561,22 @@ pri func decoder.do_transform_io?(dst: base.io_writer, src: base.io_reader, work
|
||||
}
|
||||
|
||||
pri func decoder.decode_bitstream?(dst: base.io_writer, src: base.io_reader, workbuf: roslice base.u8) {
|
||||
this.decode_bitstream_slow?(dst: args.dst, src: args.src, workbuf: args.workbuf)
|
||||
var status : base.status
|
||||
|
||||
this.end_of_chunk = false
|
||||
while true {
|
||||
status = this.decode_bitstream_fast!(dst: args.dst, src: args.src, workbuf: args.workbuf)
|
||||
if status.is_error() {
|
||||
return status
|
||||
}
|
||||
if this.end_of_chunk {
|
||||
break
|
||||
}
|
||||
this.decode_bitstream_slow?(dst: args.dst, src: args.src, workbuf: args.workbuf)
|
||||
if this.end_of_chunk {
|
||||
break
|
||||
}
|
||||
} endwhile
|
||||
}
|
||||
|
||||
pri func decoder.update_stashed_bytes?(dst: base.io_writer, workbuf: roslice base.u8) {
|
||||
|
||||
Reference in new issue
Block a user