Add io_writer.history_available method

Also change copy_n_from_history to examine the buffer start instead of
the buffer mark.

name                                             old speed     new speed     delta

wuffs_deflate_decode_1k_full_init/clang5         151MB/s ± 0%  134MB/s ± 1%  -11.11%  (p=0.000 n=10+10)
wuffs_deflate_decode_1k_part_init/clang5         187MB/s ± 0%  162MB/s ± 1%  -13.11%  (p=0.000 n=10+10)
wuffs_deflate_decode_10k_full_init/clang5        241MB/s ± 0%  220MB/s ± 0%   -8.76%  (p=0.000 n=10+10)
wuffs_deflate_decode_10k_part_init/clang5        248MB/s ± 0%  225MB/s ± 0%   -9.12%  (p=0.000 n=10+9)
wuffs_deflate_decode_100k_just_one_read/clang5   288MB/s ± 0%  270MB/s ± 0%   -6.16%  (p=0.000 n=10+10)
wuffs_deflate_decode_100k_many_big_reads/clang5  239MB/s ± 0%  225MB/s ± 0%   -5.84%  (p=0.000 n=10+10)

wuffs_deflate_decode_1k_full_init/gcc7           153MB/s ± 1%  151MB/s ± 1%   -1.13%  (p=0.000 n=10+9)
wuffs_deflate_decode_1k_part_init/gcc7           187MB/s ± 1%  186MB/s ± 1%     ~     (p=0.052 n=10+10)
wuffs_deflate_decode_10k_full_init/gcc7          261MB/s ± 0%  256MB/s ± 1%   -1.83%  (p=0.000 n=10+10)
wuffs_deflate_decode_10k_part_init/gcc7          269MB/s ± 1%  264MB/s ± 1%   -1.62%  (p=0.000 n=10+10)
wuffs_deflate_decode_100k_just_one_read/gcc7     313MB/s ± 0%  310MB/s ± 1%   -0.69%  (p=0.000 n=9+10)
wuffs_deflate_decode_100k_many_big_reads/gcc7    247MB/s ± 0%  247MB/s ± 0%     ~     (p=0.089 n=10+10)
This commit is contained in:
Nigel Tao committed 2019-07-06 11:26:05 +10:00
1 parent 4fcba3a760
commit 9f7435c7b4
5 files changed
+40 -33

No files matched your search

+5 -1
View File
@@ -245,7 +245,7 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
suffix = "_fast"
}
b.printf("wuffs_base__io_writer__copy_n_from_history%s("+
"&iop_a_dst, %sdst.private_impl.mark, io1_a_dst",
"&iop_a_dst, %sdst.private_impl.buf->data.ptr, io1_a_dst",
suffix, aPrefix)
for _, o := range args {
b.writeb(',')
@@ -281,6 +281,10 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
b.printf(", iop_a_dst - a_dst.private_impl.buf->data.ptr) : 0)")
return nil
case t.IDHistoryAvailable:
b.printf("((uint64_t)(iop_%s%s - %s%s.private_impl.buf->data.ptr))", prefix, name, prefix, name)
return nil
case t.IDMark:
b.printf("(a_dst.private_impl.buf ? ((uint64_t)(iop_a_dst - a_dst.private_impl.buf->data.ptr)) : 0)")
return nil