Nigel Tao
|
e403659c05
|
Remove more branches in std/png filters
wuffs_png_decode_19k_8bpp/clang9 95.5MB/s ± 0% 91.8MB/s ± 1% -3.90% (p=0.008 n=5+5)
wuffs_png_decode_40k_24bpp/clang9 115MB/s ± 0% 115MB/s ± 1% ~ (p=0.151 n=5+5)
wuffs_png_decode_77k_8bpp/clang9 358MB/s ± 0% 345MB/s ± 0% -3.68% (p=0.008 n=5+5)
wuffs_png_decode_552k_32bpp/clang9 124MB/s ± 0% 152MB/s ± 1% +22.35% (p=0.008 n=5+5)
wuffs_png_decode_4002k_24bpp/clang9 116MB/s ± 0% 116MB/s ± 0% ~ (p=0.151 n=5+5)
wuffs_png_decode_filter_1_sub/clang9 924MB/s ± 0% 982MB/s ± 0% +6.28% (p=0.008 n=5+5)
wuffs_png_decode_filter_2_up/clang9 13.1GB/s ± 0% 12.7GB/s ± 0% -2.73% (p=0.008 n=5+5)
wuffs_png_decode_filter_3_average/clang9 640MB/s ± 0% 757MB/s ± 0% +18.31% (p=0.008 n=5+5)
wuffs_png_decode_filter_4_paeth/clang9 64.8MB/s ± 0% 82.1MB/s ± 0% +26.72% (p=0.008 n=5+5)
wuffs_png_decode_19k_8bpp/gcc10 99.0MB/s ± 0% 98.9MB/s ± 0% ~ (p=0.222 n=5+5)
wuffs_png_decode_40k_24bpp/gcc10 114MB/s ± 1% 118MB/s ± 1% +3.38% (p=0.008 n=5+5)
wuffs_png_decode_77k_8bpp/gcc10 320MB/s ± 0% 321MB/s ± 0% +0.38% (p=0.016 n=5+4)
wuffs_png_decode_552k_32bpp/gcc10 141MB/s ± 0% 144MB/s ± 0% +1.80% (p=0.008 n=5+5)
wuffs_png_decode_4002k_24bpp/gcc10 118MB/s ± 0% 118MB/s ± 1% ~ (p=0.151 n=5+5)
wuffs_png_decode_filter_1_sub/gcc10 1.11GB/s ± 0% 0.90GB/s ± 0% -18.57% (p=0.008 n=5+5)
wuffs_png_decode_filter_2_up/gcc10 11.1GB/s ± 0% 11.0GB/s ± 0% -0.33% (p=0.008 n=5+5)
wuffs_png_decode_filter_3_average/gcc10 751MB/s ± 0% 749MB/s ± 0% -0.29% (p=0.008 n=5+5)
wuffs_png_decode_filter_4_paeth/gcc10 76.9MB/s ± 0% 81.8MB/s ± 0% +6.33% (p=0.008 n=5+5)
|
2021-01-02 23:07:04 +11:00 |
|
Nigel Tao
|
be00ccf61f
|
Add "(a - b) < c: a < c; 0 <= b" axiom
wuffs_png_decode_19k_8bpp/clang9 95.7MB/s ± 1% 95.5MB/s ± 0% ~ (p=0.151 n=5+5)
wuffs_png_decode_40k_24bpp/clang9 112MB/s ± 0% 115MB/s ± 0% +2.23% (p=0.008 n=5+5)
wuffs_png_decode_77k_8bpp/clang9 357MB/s ± 0% 358MB/s ± 0% ~ (p=0.222 n=5+5)
wuffs_png_decode_552k_32bpp/clang9 119MB/s ± 1% 124MB/s ± 0% +4.89% (p=0.008 n=5+5)
wuffs_png_decode_4002k_24bpp/clang9 114MB/s ± 0% 116MB/s ± 0% +1.95% (p=0.008 n=5+5)
wuffs_png_decode_filter_1_sub/clang9 919MB/s ± 1% 924MB/s ± 0% +0.57% (p=0.008 n=5+5)
wuffs_png_decode_filter_2_up/clang9 13.3GB/s ± 1% 13.1GB/s ± 0% -2.02% (p=0.008 n=5+5)
wuffs_png_decode_filter_3_average/clang9 554MB/s ± 0% 640MB/s ± 0% +15.61% (p=0.008 n=5+5)
wuffs_png_decode_filter_4_paeth/clang9 61.9MB/s ± 1% 64.8MB/s ± 0% +4.59% (p=0.008 n=5+5)
wuffs_png_decode_19k_8bpp/gcc10 100MB/s ± 1% 99MB/s ± 0% -0.92% (p=0.008 n=5+5)
wuffs_png_decode_40k_24bpp/gcc10 114MB/s ± 0% 114MB/s ± 1% ~ (p=0.548 n=5+5)
wuffs_png_decode_77k_8bpp/gcc10 325MB/s ± 0% 320MB/s ± 0% -1.45% (p=0.016 n=4+5)
wuffs_png_decode_552k_32bpp/gcc10 160MB/s ± 0% 141MB/s ± 0% -11.59% (p=0.016 n=4+5)
wuffs_png_decode_4002k_24bpp/gcc10 117MB/s ± 0% 118MB/s ± 0% +0.91% (p=0.008 n=5+5)
wuffs_png_decode_filter_1_sub/gcc10 979MB/s ± 0% 1109MB/s ± 0% +13.30% (p=0.008 n=5+5)
wuffs_png_decode_filter_2_up/gcc10 11.5GB/s ± 1% 11.1GB/s ± 0% -3.88% (p=0.008 n=5+5)
wuffs_png_decode_filter_3_average/gcc10 644MB/s ± 0% 751MB/s ± 0% +16.69% (p=0.008 n=5+5)
wuffs_png_decode_filter_4_paeth/gcc10 84.3MB/s ± 1% 76.9MB/s ± 0% -8.74% (p=0.008 n=5+5)
|
2021-01-02 22:46:53 +11:00 |
|
Nigel Tao
|
ed48514f30
|
Remove ast.NewExpr statusPkg arg
|
2020-06-10 12:05:48 +10:00 |
|
Nigel Tao
|
3338d6d1bc
|
Write LZW output 8 bytes at a time, not 1
The benchmarks are mixed, but I think it's still a net win.
----
name old speed new speed delta
wuffs_gif_decode_1k_bw/clang 258MB/s ± 0% 253MB/s ± 1% -2.04% (p=0.008 n=5+5)
wuffs_gif_decode_1k_color/clang 159MB/s ± 0% 116MB/s ± 0% -26.76% (p=0.008 n=5+5)
wuffs_gif_decode_10k/clang 167MB/s ± 0% 138MB/s ± 0% -17.42% (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang 205MB/s ± 0% 439MB/s ± 0% +114.53% (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/clang 151MB/s ± 0% 164MB/s ± 0% +8.41% (p=0.008 n=5+5)
wuffs_gif_decode_1000k/clang 155MB/s ± 0% 165MB/s ± 0% +6.50% (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/clang 255MB/s ± 0% 921MB/s ± 0% +261.50% (p=0.008 n=5+5)
wuffs_gif_decode_1k_bw/gcc 316MB/s ± 2% 267MB/s ± 1% -15.78% (p=0.008 n=5+5)
wuffs_gif_decode_1k_color/gcc 184MB/s ± 1% 134MB/s ± 0% -27.57% (p=0.008 n=5+5)
wuffs_gif_decode_10k/gcc 196MB/s ± 0% 161MB/s ± 0% -17.50% (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc 287MB/s ± 0% 449MB/s ± 1% +56.22% (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/gcc 182MB/s ± 0% 182MB/s ± 1% ~ (p=0.690 n=5+5)
wuffs_gif_decode_1000k/gcc 187MB/s ± 1% 185MB/s ± 1% ~ (p=0.056 n=5+5)
wuffs_gif_decode_anim_screencap/gcc 397MB/s ± 0% 973MB/s ± 0% +145.42% (p=0.008 n=5+5)
wuffs_lzw_decode_20k/clang 170MB/s ± 0% 191MB/s ± 1% +12.52% (p=0.008 n=5+5)
wuffs_lzw_decode_100k/clang 242MB/s ± 0% 312MB/s ± 2% +29.00% (p=0.008 n=5+5)
wuffs_lzw_decode_20k/gcc 220MB/s ± 0% 227MB/s ± 0% +3.31% (p=0.008 n=5+5)
wuffs_lzw_decode_100k/gcc 317MB/s ± 0% 369MB/s ± 1% +16.53% (p=0.008 n=5+5)
----
LZW is the compression method used by GIF images. Roughly speaking, LZW
is a sequence of codes, and each code emits either 1 byte (a literal
code) or multiple bytes (a copy code). The speed gain in this commit
comes from, when emitting an N-byte copy code, this now requires N/8
iterations instead of N iterations, as each iteration now writes 8 bytes
instead of 1. Literal codes, both before and after this commit, requires
a single iteration.
Decoding should therefore get faster or slower depending on whether it's
copy-code-heavy or literal-code-heavy respectively. For what it's worth,
copy-code-heavy GIF images also usually compress better.
Running script/extract-giflzw.go (or examining the cached output at
test/data/analysis/giflzw-emission-lengths.txt) on the anim_screencap
(which got faster) and 1k_color (which got slower) cases (also known as
gifplayer-muybridge.gif and hippopotamus.regular.gif) shows that the
proportion of literal codes agrees with that explanation.
----
gifplayer-muybridge.gif (all frames)
Percent Count Emission_Length_Bucket
12.78 34658 1 (Literal Code)
14.05 38106 2
13.25 35937 3
10.59 28707 4
7.85 21286 5
6.08 16481 6
4.85 13156 7
3.60 9764 8
9.34 25318 9 .. 16
4.89 13257 17 .. 32
4.78 12954 33 .. 64
4.72 12806 65 .. 128
3.02 8190 127 .. 256
0.20 550 256+
hippopotamus.regular.gif (all frames)
Percent Count Emission_Length_Bucket
82.66 672 1 (Literal Code)
13.04 106 2
2.83 23 3
0.86 7 4
0.37 3 5
0.25 2 6
0.00 0 7
0.00 0 8
0.00 0 9 .. 16
0.00 0 17 .. 32
0.00 0 33 .. 64
0.00 0 65 .. 128
0.00 0 127 .. 256
0.00 0 256+
----
The new algorithm also adds more CPU and RAM overhead, regardless of
whether the input GIF image's LZW data is copy-code-heavy or
literal-code-heavy. For example, the suffix table grows by 8x, from 4KiB
to 32 KiB.
The gifplayer-muybridge.gif image is also larger (472 x 298) and the
hippopotamus.regular.gif image is also smaller (36 x 28). Higher fixed
costs may have larger (negative) relative effects on decoding smaller
images.
To repeat, I think it's still a net win.
An upcoming commit will update the std/lzw/README.md file to provide
more detail on the algorithm.
Thanks to Tushar Khandelwal for the idea.
|
2018-10-21 14:48:40 +11:00 |
|
Nigel Tao
|
34049e52d8
|
Optimize deflate Huffman; tighten an if
name old speed new speed delta
wuffs_deflate_decode_1k/clang 148MB/s ± 0% 149MB/s ± 0% +0.61% (p=0.008 n=5+5)
wuffs_deflate_decode_10k/clang 228MB/s ± 1% 235MB/s ± 0% +3.45% (p=0.016 n=5+4)
wuffs_deflate_decode_100k/clang 253MB/s ± 0% 262MB/s ± 0% +3.42% (p=0.008 n=5+5)
wuffs_deflate_decode_1k/gcc 158MB/s ± 1% 157MB/s ± 0% -0.44% (p=0.032 n=5+5)
wuffs_deflate_decode_10k/gcc 265MB/s ± 0% 274MB/s ± 0% +3.31% (p=0.008 n=5+5)
wuffs_deflate_decode_100k/gcc 300MB/s ± 0% 317MB/s ± 0% +5.45% (p=0.008 n=5+5)
|
2018-10-07 18:13:25 +11:00 |
|
Nigel Tao
|
ccb78f5db7
|
Rename ast.Node methods from Foo to AsFoo
|
2018-07-01 20:41:21 +10:00 |
|
Nigel Tao
|
e00e71da7b
|
Remove ast.FlagsTypeChecked
|
2018-05-14 16:11:18 +10:00 |
|
Nigel Tao
|
eeebd58d7b
|
Remove token ID/Key distinction, part 11 of N
|
2018-04-15 17:57:10 +10:00 |
|
Nigel Tao
|
4675efdcc5
|
Fix deflate decode when the distance is 32768
|
2018-03-23 12:49:42 +11:00 |
|
Nigel Tao
|
1004d898d5
|
Add statusPkg arg to ast.NewExpr
|
2017-12-29 13:33:46 +11:00 |
|
Nigel Tao
|
79a94558be
|
Rename PUFFS to WUFFS, part 5 of N
|
2017-11-30 16:37:20 +11:00 |
|
Nigel Tao
|
0cea46531b
|
Rename PUFFS to WUFFS, part 2 of N
|
2017-11-30 16:23:16 +11:00 |
|
Nigel Tao
|
d4372cb5b8
|
Change license to Apache 2.
Also remove explicit PATENTS file. The new LICENSE file already
discusses patents.
Note that the Puffs project has not yet been publicly released.
|
2017-10-12 11:17:41 +11:00 |
|
Nigel Tao
|
7cf7829c9e
|
Implement std/flate Huffman table redirects.
|
2017-07-29 16:25:00 +10:00 |
|
Nigel Tao
|
eee67e083d
|
Add array-of-u32 Huffman decoder.
|
2017-07-27 11:30:43 +10:00 |
|
Nigel Tao
|
59320a07d0
|
Rename "go generate"d files to be data.go.
|
2017-07-22 17:57:41 +10:00 |
|