mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 00:47:28 +01:00
Unroll the std/crc32 loop
name old speed new speed delta wuffs_crc32_ieee_10k/clang 2.30GB/s ± 1% 2.37GB/s ± 0% +3.31% (p=0.016 n=5+4) wuffs_crc32_ieee_100k/clang 2.30GB/s ± 0% 2.35GB/s ± 0% +2.39% (p=0.008 n=5+5) wuffs_crc32_ieee_10k/gcc 2.49GB/s ± 1% 2.72GB/s ± 0% +9.19% (p=0.008 n=5+5) wuffs_crc32_ieee_100k/gcc 2.50GB/s ± 0% 2.70GB/s ± 1% +8.18% (p=0.008 n=5+5) wuffs_gzip_decode_10k/clang 206MB/s ± 2% 207MB/s ± 0% ~ (p=1.000 n=5+5) wuffs_gzip_decode_100k/clang 231MB/s ± 2% 235MB/s ± 0% +1.57% (p=0.008 n=5+5) wuffs_gzip_decode_10k/gcc 234MB/s ± 0% 235MB/s ± 1% ~ (p=0.095 n=5+5) wuffs_gzip_decode_100k/gcc 267MB/s ± 0% 266MB/s ± 2% ~ (p=0.690 n=5+5)
This commit is contained in:
1 parent
a23681d1ba
commit
58cd282138
3 files changed
+118
-4
No files matched your search
@@ -244,10 +244,10 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
|
||||
unroll := n.Unroll().SmallPowerOf2Value()
|
||||
step := n.Step().SmallPowerOf2Value()
|
||||
|
||||
if uStep := unroll * step; uStep > 1 {
|
||||
if unroll > 1 || step > 1 {
|
||||
b.printf("%s%s.len = %d;\n", vPrefix, name, step)
|
||||
b.printf("uint8_t* %send0_%s = %sslice_%s.ptr + (%sslice_%s.len / %d) * %d;\n",
|
||||
iPrefix, name, iPrefix, name, iPrefix, name, uStep, uStep)
|
||||
iPrefix, name, iPrefix, name, iPrefix, name, unroll*step, unroll*step)
|
||||
b.printf("while (%s%s.ptr < %send0_%s) {\n", vPrefix, name, iPrefix, name)
|
||||
for i := 0; i < unroll; i++ {
|
||||
for _, o := range n.Body() {
|
||||
@@ -260,6 +260,20 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
|
||||
b.writes("}\n")
|
||||
}
|
||||
|
||||
if unroll > 1 && step > 1 {
|
||||
b.printf("%s%s.len = %d;\n", vPrefix, name, step)
|
||||
b.printf("uint8_t* %send1_%s = %sslice_%s.ptr + (%sslice_%s.len / %d) * %d;\n",
|
||||
iPrefix, name, iPrefix, name, iPrefix, name, step, step)
|
||||
b.printf("while (%s%s.ptr < %send1_%s) {\n", vPrefix, name, iPrefix, name)
|
||||
for _, o := range n.Body() {
|
||||
if err := g.writeStatement(b, o, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
b.printf("%s%s.ptr += %d;\n", vPrefix, name, step)
|
||||
b.writes("}\n")
|
||||
}
|
||||
|
||||
{
|
||||
b.printf("%s%s.len = %d;\n", vPrefix, name, 1)
|
||||
b.printf("uint8_t* %send2_%s = %sslice_%s.ptr + %sslice_%s.len;\n",
|
||||
|
||||
Reference in new issue
Block a user