Add mark/since/count_since methods

name                                             old speed     new speed     delta

wuffs_deflate_decode_1k_full_init/clang5         149MB/s ± 0%  151MB/s ± 1%  +1.46%  (p=0.000 n=9+7)
wuffs_deflate_decode_1k_part_init/clang5         183MB/s ± 1%  188MB/s ± 2%  +2.40%  (p=0.000 n=10+10)
wuffs_deflate_decode_10k_full_init/clang5        236MB/s ± 0%  242MB/s ± 1%  +2.56%  (p=0.000 n=10+10)
wuffs_deflate_decode_10k_part_init/clang5        243MB/s ± 0%  249MB/s ± 0%  +2.36%  (p=0.000 n=9+9)
wuffs_deflate_decode_100k_just_one_read/clang5   279MB/s ± 0%  288MB/s ± 1%  +3.28%  (p=0.000 n=9+8)
wuffs_deflate_decode_100k_many_big_reads/clang5  232MB/s ± 0%  240MB/s ± 1%  +3.76%  (p=0.000 n=9+9)

wuffs_deflate_decode_1k_full_init/gcc7           152MB/s ± 1%  152MB/s ± 1%    ~     (p=0.661 n=10+9)
wuffs_deflate_decode_1k_part_init/gcc7           188MB/s ± 0%  187MB/s ± 1%  -0.58%  (p=0.013 n=10+9)
wuffs_deflate_decode_10k_full_init/gcc7          260MB/s ± 0%  260MB/s ± 0%    ~     (p=0.393 n=10+10)
wuffs_deflate_decode_10k_part_init/gcc7          268MB/s ± 0%  268MB/s ± 0%    ~     (p=0.971 n=10+10)
wuffs_deflate_decode_100k_just_one_read/gcc7     312MB/s ± 1%  312MB/s ± 0%    ~     (p=0.720 n=10+9)
wuffs_deflate_decode_100k_many_big_reads/gcc7    247MB/s ± 1%  247MB/s ± 0%  -0.26%  (p=0.022 n=10+9)
This commit is contained in:
Nigel Tao committed 2019-07-06 09:58:51 +10:00
1 parent e5f535db4f
commit ff1e3c9c48
10 files changed
+157 -42

No files matched your search

+6 -5
View File
@@ -139,21 +139,22 @@ pub func decoder.workbuf_len() base.range_ii_u64 {
}
pub func decoder.decode_io_writer?(dst base.io_writer, src base.io_reader, workbuf slice base.u8) {
var mark base.u64
var status base.status
var written slice base.u8
var n_copied base.u64
var already_full base.u32[..0x8000]
while true {
args.dst.set_mark!()
mark = args.dst.mark()
status =? this.decode_blocks?(dst:args.dst, src:args.src)
if not status.is_suspension() {
return status
}
// TODO: should "since_mark" be "since_mark!", as the return value lets
// you modify the state of args.dst, so future mutations (via the
// slice) can change the veracity of any args.dst assertions?
written = args.dst.since_mark()
// TODO: should "since" be "since!", as the return value lets you
// modify the state of args.dst, so future mutations (via the slice)
// can change the veracity of any args.dst assertions?
written = args.dst.since(mark:mark)
// Append written, the decoded output, to the history ringbuffer.
if written.length() >= 0x8000 {
// If written is longer than the ringbuffer, we can ignore the
+4 -3
View File
@@ -46,6 +46,7 @@ pub func decoder.decode_io_writer?(dst base.io_writer, src base.io_reader, workb
var c base.u8
var flags base.u8
var xlen base.u16
var mark base.u64
var checksum_got base.u32
var decoded_length_got base.u32
var status base.status
@@ -111,11 +112,11 @@ pub func decoder.decode_io_writer?(dst base.io_writer, src base.io_reader, workb
// Decode and checksum the DEFLATE-encoded payload.
while true {
args.dst.set_mark!()
mark = args.dst.mark()
status =? this.flate.decode_io_writer?(dst:args.dst, src:args.src, workbuf:args.workbuf)
if not this.ignore_checksum {
checksum_got = this.checksum.update!(x:args.dst.since_mark())
decoded_length_got ~mod+= ((args.dst.since_mark().length() & 0xFFFFFFFF) as base.u32)
checksum_got = this.checksum.update!(x:args.dst.since(mark:mark))
decoded_length_got ~mod+= ((args.dst.count_since(mark:mark) & 0xFFFFFFFF) as base.u32)
}
if status.is_ok() {
break
+3 -2
View File
@@ -49,6 +49,7 @@ pub func decoder.decode_io_writer?(dst base.io_writer, src base.io_reader, workb
var checksum_got base.u32
var status base.status
var checksum_want base.u32
var mark base.u64
x = args.src.read_u16be?()
if ((x >> 8) & 0x0F) <> 0x08 {
@@ -66,10 +67,10 @@ pub func decoder.decode_io_writer?(dst base.io_writer, src base.io_reader, workb
// Decode and checksum the DEFLATE-encoded payload.
while true {
args.dst.set_mark!()
mark = args.dst.mark()
status =? this.flate.decode_io_writer?(dst:args.dst, src:args.src, workbuf:args.workbuf)
if not this.ignore_checksum {
checksum_got = this.checksum.update!(x:args.dst.since_mark())
checksum_got = this.checksum.update!(x:args.dst.since(mark:mark))
}
if status.is_ok() {
break