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

+40
View File
@@ -144,6 +144,18 @@ func (g *gen) writeBuiltinIOReader(b *buffer, recv *a.Expr, method t.ID, args []
b.writes("(iop_a_src > io0_a_src)")
return nil
case t.IDCountSince:
b.printf("(a_src.private_impl.buf ? wuffs_base__io__count_since(")
if err := g.writeExpr(b, args[0].AsArg().Value(), depth); err != nil {
return err
}
b.printf(", iop_a_src - a_src.private_impl.buf->data.ptr) : 0)")
return nil
case t.IDMark:
b.printf("(a_src.private_impl.buf ? ((uint64_t)(iop_a_src - a_src.private_impl.buf->data.ptr)) : 0)")
return nil
case t.IDPosition:
b.printf("(a_src.private_impl.buf ? wuffs_base__u64__sat_add(" +
"a_src.private_impl.buf->meta.pos, ((uint64_t)(iop_a_src - a_src.private_impl.buf->data.ptr))) : 0)")
@@ -158,6 +170,14 @@ func (g *gen) writeBuiltinIOReader(b *buffer, recv *a.Expr, method t.ID, args []
b.printf("wuffs_base__io_reader__set_mark(&%ssrc, iop_a_src)", aPrefix)
return nil
case t.IDSince:
b.printf("(a_src.private_impl.buf ? wuffs_base__io__since(")
if err := g.writeExpr(b, args[0].AsArg().Value(), depth); err != nil {
return err
}
b.printf(", iop_a_src - a_src.private_impl.buf->data.ptr, a_src.private_impl.buf->data.ptr) : wuffs_base__make_slice_u8(NULL, 0))")
return nil
case t.IDSinceMark, t.IDSinceMarkLength:
prefix, name := aPrefix, "src"
if recv.Operator() == 0 {
@@ -245,6 +265,18 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
b.printf("wuffs_base__io_writer__copy_n_from_slice(&iop_a_dst, io1_a_dst,")
return g.writeArgs(b, args, depth)
case t.IDCountSince:
b.printf("(a_dst.private_impl.buf ? wuffs_base__io__count_since(")
if err := g.writeExpr(b, args[0].AsArg().Value(), depth); err != nil {
return err
}
b.printf(", iop_a_dst - a_dst.private_impl.buf->data.ptr) : 0)")
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
case t.IDPosition:
b.printf("(a_dst.private_impl.buf ? wuffs_base__u64__sat_add(" +
"a_dst.private_impl.buf->meta.pos, iop_a_dst - a_dst.private_impl.buf->data.ptr) : 0)")
@@ -258,6 +290,14 @@ func (g *gen) writeBuiltinIOWriter(b *buffer, recv *a.Expr, method t.ID, args []
b.printf("wuffs_base__io_writer__set_mark(&%sdst, iop_a_dst)", aPrefix)
return nil
case t.IDSince:
b.printf("(a_dst.private_impl.buf ? wuffs_base__io__since(")
if err := g.writeExpr(b, args[0].AsArg().Value(), depth); err != nil {
return err
}
b.printf(", iop_a_dst - a_dst.private_impl.buf->data.ptr, a_dst.private_impl.buf->data.ptr) : wuffs_base__make_slice_u8(NULL, 0))")
return nil
case t.IDSinceMark, t.IDSinceMarkLength:
prefix, name := aPrefix, "dst"
if recv.Operator() == 0 {