Factor lzw's decode into read and write halves

name                                    old speed      new speed      delta

wuffs_lzw_decode_20k/clang               203MB/s ± 3%   240MB/s ± 1%  +17.93%  (p=0.000 n=49+5)
wuffs_lzw_decode_100k/clang              334MB/s ± 4%   413MB/s ± 0%  +23.75%  (p=0.000 n=50+5)

wuffs_lzw_decode_20k/gcc                 235MB/s ± 2%   254MB/s ± 2%   +8.40%  (p=0.000 n=45+5)
wuffs_lzw_decode_100k/gcc                395MB/s ± 2%   455MB/s ± 2%  +15.06%  (p=0.000 n=45+5)

wuffs_gif_decode_1k_bw/clang             229MB/s ± 1%   240MB/s ± 0%   +4.51%  (p=0.000 n=49+5)
wuffs_gif_decode_1k_color/clang          120MB/s ± 1%   134MB/s ± 1%  +11.44%  (p=0.000 n=46+5)
wuffs_gif_decode_10k_bgra/clang          557MB/s ± 1%   649MB/s ± 0%  +16.56%  (p=0.000 n=47+5)
wuffs_gif_decode_10k_indexed/clang       149MB/s ± 1%   174MB/s ± 1%  +17.11%  (p=0.000 n=48+5)
wuffs_gif_decode_100k_artificial/clang   459MB/s ± 1%   514MB/s ± 1%  +11.95%  (p=0.000 n=47+5)
wuffs_gif_decode_100k_realistic/clang    175MB/s ± 1%   204MB/s ± 0%  +16.80%  (p=0.000 n=47+5)
wuffs_gif_decode_1000k/clang             178MB/s ± 1%   207MB/s ± 0%  +16.21%  (p=0.000 n=46+5)
wuffs_gif_decode_anim_screencap/clang    961MB/s ± 1%  1060MB/s ± 1%  +10.35%  (p=0.000 n=46+5)

wuffs_gif_decode_1k_bw/gcc               244MB/s ± 1%   261MB/s ± 0%   +6.86%  (p=0.000 n=47+5)
wuffs_gif_decode_1k_color/gcc            133MB/s ± 1%   145MB/s ± 0%   +9.44%  (p=0.000 n=48+5)
wuffs_gif_decode_10k_bgra/gcc            543MB/s ± 2%   593MB/s ± 1%   +9.22%  (p=0.000 n=49+5)
wuffs_gif_decode_10k_indexed/gcc         166MB/s ± 1%   185MB/s ± 0%  +11.55%  (p=0.000 n=47+5)
wuffs_gif_decode_100k_artificial/gcc     464MB/s ± 1%   512MB/s ± 0%  +10.51%  (p=0.000 n=47+5)
wuffs_gif_decode_100k_realistic/gcc      190MB/s ± 1%   211MB/s ± 0%  +11.05%  (p=0.000 n=47+5)
wuffs_gif_decode_1000k/gcc               193MB/s ± 1%   215MB/s ± 0%  +11.54%  (p=0.000 n=44+5)
wuffs_gif_decode_anim_screencap/gcc     1.00GB/s ± 1%  1.07GB/s ± 0%   +7.76%  (p=0.000 n=45+5)
This commit is contained in:
Nigel Tao committed 2018-12-26 11:08:37 +11:00
1 parent c2a48ae6d3
commit c2826e87e3
3 files changed
+372 -331

No files matched your search

+15 -1
View File
@@ -263,7 +263,10 @@ func (g *gen) writeFuncImplPrologue(b *buffer) error {
}
b.writes("\n")
if g.currFunk.astFunc.Effect().Optional() {
if g.currFunk.astFunc.Effect().Optional() ||
// TODO: delete this lzw.read_from hack.
((g.pkgName == "lzw") && (g.currFunk.astFunc.FuncName().Str(g.tm) == "read_from")) {
g.findDerivedVars()
for _, o := range g.currFunk.astFunc.In().Fields() {
o := o.AsField()
@@ -331,6 +334,17 @@ func (g *gen) writeFuncImplBodySuspend(b *buffer) error {
}
func (g *gen) writeFuncImplEpilogue(b *buffer) error {
// TODO: delete this lzw.read_from hack.
if (g.pkgName == "lzw") && (g.currFunk.astFunc.FuncName().Str(g.tm) == "read_from") {
for _, o := range g.currFunk.astFunc.In().Fields() {
o := o.AsField()
if err := g.writeSaveDerivedVar(b, "", aPrefix, o.Name(), o.XType()); err != nil {
return err
}
}
b.writes("\n")
}
if g.currFunk.astFunc.Effect().Optional() {
b.writes("goto exit;exit:") // The goto avoids the "unused label" warning.