mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 16:47:28 +01:00
Allow p[i] for ptr-typed p; speed up std/crc32
name old speed new speed delta wuffs_crc32_ieee_10k/clang 483MB/s ± 1% 2263MB/s ± 3% +368.94% (p=0.000 n=48+5) wuffs_crc32_ieee_100k/clang 482MB/s ± 1% 2257MB/s ± 3% +367.96% (p=0.000 n=48+5) wuffs_crc32_ieee_10k/gcc 419MB/s ± 1% 2473MB/s ± 1% +489.93% (p=0.000 n=48+5) wuffs_crc32_ieee_100k/gcc 419MB/s ± 1% 2465MB/s ± 1% +488.02% (p=0.000 n=47+5) wuffs_gzip_decode_10k/clang 153MB/s ± 1% 208MB/s ± 0% +35.30% (p=0.000 n=48+5) wuffs_gzip_decode_100k/clang 168MB/s ± 1% 236MB/s ± 0% +40.67% (p=0.000 n=50+4) wuffs_gzip_decode_10k/gcc 156MB/s ± 1% 231MB/s ± 3% +47.91% (p=0.000 n=50+5) wuffs_gzip_decode_100k/gcc 172MB/s ± 1% 267MB/s ± 0% +55.64% (p=0.000 n=48+5)
This commit is contained in:
1 parent
e72f957eca
commit
f64bf4af61
7 files changed
+35
-11
No files matched your search
@@ -855,6 +855,9 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int,
|
||||
lengthExpr := (*a.Expr)(nil)
|
||||
if lTyp := lhs.MType(); lTyp.IsArrayType() {
|
||||
lengthExpr = lTyp.ArrayLength()
|
||||
} else if lTyp.IsPtrType() {
|
||||
// TODO: don't skip bounds checking p[i] for ptr-typed p.
|
||||
break
|
||||
} else {
|
||||
lengthExpr = makeSliceLengthExpr(lhs)
|
||||
}
|
||||
@@ -874,6 +877,7 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int,
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
// TODO: slicing "ptr T" types?
|
||||
lengthExpr := (*a.Expr)(nil)
|
||||
if lTyp := lhs.MType(); lTyp.IsArrayType() {
|
||||
lengthExpr = lTyp.ArrayLength()
|
||||
|
||||
+3
-2
@@ -471,8 +471,8 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
|
||||
return err
|
||||
}
|
||||
lTyp := lhs.MType()
|
||||
if key := lTyp.Decorator(); key != t.IDArray && key != t.IDSlice {
|
||||
return fmt.Errorf("check: %s is an index expression but %s has type %s, not an array or slice type",
|
||||
if key := lTyp.Decorator(); key != t.IDArray && key != t.IDPtr && key != t.IDSlice {
|
||||
return fmt.Errorf("check: %s is an index expression but %s has type %s, not an array, ptr or slice type",
|
||||
n.Str(q.tm), lhs.Str(q.tm), lTyp.Str(q.tm))
|
||||
}
|
||||
rTyp := rhs.MType()
|
||||
@@ -518,6 +518,7 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
|
||||
n.Str(q.tm), lhs.Str(q.tm), lTyp.Str(q.tm))
|
||||
case t.IDArray:
|
||||
n.SetMType(a.NewTypeExpr(t.IDSlice, 0, 0, nil, nil, lTyp.Inner()))
|
||||
// TODO: case t.IDPtr?
|
||||
case t.IDSlice:
|
||||
n.SetMType(lTyp)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user