mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 00:47:28 +01:00
Prepare to optimize w.since_mark.
It's not obvious why the benchmark numbers don't improve, so the intuitively-better codegen is disabled for now. I'm also having trouble exactly reproducing the numbers from yesterdays' commits. While I'm investigating, land this commit and move on.
This commit is contained in:
1 parent
3bdd515e47
commit
67fb7bf1dc
3 files changed
+123
-51
No files matched your search
@@ -198,10 +198,19 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
|
||||
return nil
|
||||
}
|
||||
if isInDst(g.tm, n, t.KeySinceMark, 0) {
|
||||
// Write .len as either "foo ? bar : baz" or "bar".
|
||||
//
|
||||
// TODO: drop the "true" in the "if true", provided that the
|
||||
// benchmark numbers improve.
|
||||
len0, len1 := "", ""
|
||||
if true || !n.BoundsCheckOptimized() {
|
||||
len0 = aPrefix + "dst.private_impl.mark ?"
|
||||
len1 = ": 0"
|
||||
}
|
||||
b.printf("((puffs_base__slice_u8){ "+
|
||||
".ptr = %sdst.private_impl.mark, "+
|
||||
".len = %sdst.private_impl.mark ? (size_t)(%swptr_dst - %sdst.private_impl.mark) : 0, })",
|
||||
aPrefix, aPrefix, bPrefix, aPrefix)
|
||||
".len = %s (size_t)(%swptr_dst - %sdst.private_impl.mark) %s, })",
|
||||
aPrefix, len0, bPrefix, aPrefix, len1)
|
||||
return nil
|
||||
}
|
||||
if isInDst(g.tm, n, t.KeyIsMarked, 0) {
|
||||
|
||||
Reference in new issue
Block a user