Drop the "?" from "copy_history32?".

This makes the caller, not the implementation, responsible for detecting
short reads and writes. This (the lack of "?") is consistent with the
slice.copy_from method.

name                           old speed     new speed     delta
puffs_flate_decode_1k/clang    117MB/s ± 6%  120MB/s ± 0%   +2.31%  (p=0.016 n=5+5)
puffs_flate_decode_10k/clang   153MB/s ± 1%  155MB/s ± 0%   +1.16%  (p=0.008 n=5+5)
puffs_flate_decode_100k/clang  168MB/s ± 1%  177MB/s ± 0%   +5.41%  (p=0.008 n=5+5)
puffs_flate_decode_1k/gcc      127MB/s ± 1%  143MB/s ± 0%  +12.15%  (p=0.008 n=5+5)
puffs_flate_decode_10k/gcc     145MB/s ± 0%  180MB/s ± 1%  +24.00%  (p=0.008 n=5+5)
puffs_flate_decode_100k/gcc    163MB/s ± 0%  212MB/s ± 1%  +29.90%  (p=0.008 n=5+5)
This commit is contained in:
Nigel Tao committed 2017-10-06 17:02:09 +11:00
1 parent a1271222a4
commit 2e883fcc23
11 files changed
+155 -116

No files matched your search

+1
View File
@@ -61,6 +61,7 @@ var (
typeExprList = a.NewTypeExpr(0, t.IDDollar, nil, nil, nil)
typeExprStatus = a.NewTypeExpr(0, t.IDStatus, nil, nil, nil)
typeExprU8 = a.NewTypeExpr(0, t.IDU8, nil, nil, nil)
typeExprU32 = a.NewTypeExpr(0, t.IDU32, nil, nil, nil)
typeExprU64 = a.NewTypeExpr(0, t.IDU64, nil, nil, nil)
typeExprSliceU8 = a.NewTypeExpr(t.IDColon, 0, nil, nil, typeExprU8)
+3 -1
View File
@@ -378,6 +378,8 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
n.SetMType(typeExprPlaceholder16) // HACK.
} else if isInDst(q.tm, n, t.KeySlice, 0) {
n.SetMType(typeExprSliceU8) // HACK.
} else if isInDst(q.tm, n, t.KeyCopyHistory32, 2) {
n.SetMType(typeExprU32) // HACK.
} else {
n.SetMType(typeExprPlaceholder) // HACK.
}
@@ -591,7 +593,7 @@ func isInSrc(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
}
func isInDst(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
callSuspendible := methodName != t.KeySlice
callSuspendible := methodName != t.KeyCopyHistory32 && methodName != t.KeySlice
// TODO: check that n.Args() is "(x:bar)".
if n.ID0().Key() != t.KeyOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
return false