mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 00:47:28 +01:00
Unroll iterate loops.
name old speed new speed delta puffs_adler32_10k/clang 2.12GB/s ± 1% 2.42GB/s ± 1% +14.24% (p=0.008 n=5+5) puffs_adler32_100k/clang 2.12GB/s ± 3% 2.43GB/s ± 0% +14.29% (p=0.008 n=5+5) mimic_adler32_10k/clang 2.93GB/s ± 2% 2.96GB/s ± 0% ~ (p=0.310 n=5+5) mimic_adler32_100k/clang 2.89GB/s ± 2% 2.91GB/s ± 0% ~ (p=1.000 n=5+5) puffs_adler32_10k/gcc 2.17GB/s ± 1% 3.23GB/s ± 0% +48.59% (p=0.008 n=5+5) puffs_adler32_100k/gcc 2.18GB/s ± 1% 3.23GB/s ± 0% +48.34% (p=0.008 n=5+5) mimic_adler32_10k/gcc 2.97GB/s ± 0% 2.96GB/s ± 1% ~ (p=1.000 n=5+5) mimic_adler32_100k/gcc 2.91GB/s ± 1% 2.91GB/s ± 1% ~ (p=0.548 n=5+5)
This commit is contained in:
1 parent
b024cb1d8c
commit
245e3ec7b9
6 files changed
+94
-19
No files matched your search
+21
-1
@@ -570,6 +570,26 @@ func (p *parser) parseStatement1() (*a.Node, error) {
|
||||
|
||||
case t.KeyIterate:
|
||||
p.src = p.src[1:]
|
||||
if x := p.peek1().Key(); x != t.KeyDot {
|
||||
got := p.tm.ByKey(x)
|
||||
return nil, fmt.Errorf(`parse: expected ".", got %q at %s:%d`, got, p.filename, p.line())
|
||||
}
|
||||
p.src = p.src[1:]
|
||||
unrollID := p.peek1()
|
||||
unrollStr := p.tm.ByKey(unrollID.Key())
|
||||
if !unrollID.IsLiteral() {
|
||||
return nil, fmt.Errorf(`parse: expected literal unroll count, got %q at %s:%d`,
|
||||
unrollStr, p.filename, p.line())
|
||||
}
|
||||
p.src = p.src[1:]
|
||||
switch unrollStr {
|
||||
default:
|
||||
return nil, fmt.Errorf(`parse: expected power-of-2 unroll count in [1..256], got %q at %s:%d`,
|
||||
unrollStr, p.filename, p.line())
|
||||
case "1", "2", "4", "8", "16", "32", "64", "128", "256":
|
||||
}
|
||||
unroll := a.NewExpr(0, 0, unrollID, nil, nil, nil, nil)
|
||||
|
||||
label, err := p.parseLabel()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -586,7 +606,7 @@ func (p *parser) parseStatement1() (*a.Node, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return a.NewIterate(label, vars, asserts, body).Node(), nil
|
||||
return a.NewIterate(label, unroll, vars, asserts, body).Node(), nil
|
||||
|
||||
case t.KeyWhile:
|
||||
p.src = p.src[1:]
|
||||
|
||||
Reference in new issue
Block a user