Files
wuffs/release/c
Nigel Tao 83a72f3d77 Performance mystery: unused pixel swizzler code
A recent commit (c392a632de, "Swizzler let
src_pixfmt = INDEXED__BGRA_NONPREMUL") introduced new pixel swizzler
functions. These code paths weren't taken by the std/gif codec, but for
some mysterious reason, they dramatically impact the std/gif benchmarks.

To record that quantitatively in the git log, this commit touches the
INDEXED__BGRA_NONPREMUL code (editing wuffs-unsupported-snapshot.c
directly), making it incorrect but affecting the std/gif benchmarks (for
gcc10 but not for clang9). To repeat, the new code is not exercised by
the std/gif code. Even though test_wuffs_pixel_swizzler_swizzle now
fails, the std/gif tests still pass with this incorrect commit.

It is a mystery why this happens. This small, self-contained commit
will be immediately followed by a roll back, but it is committed anyway
so that we can refer to these numbers in the git log. To reproduce:

----
$ git clone https://github.com/google/wuffs.git
$ cd wuffs
$ gcc --version | head -n 1
gcc (Debian 10.2.1-3) 10.2.1 20201224

$ # Check out this commit.
$ git checkout --quiet THE_HASH_OF_THIS_COMMIT
$ gcc -O3 -Wall -std=c99 test/c/std/gif.c -DWUFFS_MIMIC -lgif
$ ./a.out -bench -focus=wuffs_gif_decode_1000k_full_init | grep MB/s
Benchmarkwuffs_gif_decode_1000k_full_init/gcc10	     100	 8242690 ns/op	     121.408 MB/s
Benchmarkwuffs_gif_decode_1000k_full_init/gcc10	     100	 8233370 ns/op	     121.546 MB/s
Benchmarkwuffs_gif_decode_1000k_full_init/gcc10	     100	 8228690 ns/op	     121.615 MB/s
Benchmarkwuffs_gif_decode_1000k_full_init/gcc10	     100	 8236640 ns/op	     121.497 MB/s
Benchmarkwuffs_gif_decode_1000k_full_init/gcc10	     100	 8239820 ns/op	     121.451 MB/s

$ # Check out the parent commit.
$ git checkout --quiet THE_HASH_OF_THIS_COMMIT^
$ gcc -O3 -Wall -std=c99 test/c/std/gif.c -DWUFFS_MIMIC -lgif
$ ./a.out -bench -focus=wuffs_gif_decode_1000k_full_init | grep MB/s
Benchmarkwuffs_gif_decode_1000k_full_init/gcc10	     100	 9614630 ns/op	     104.084 MB/s
Benchmarkwuffs_gif_decode_1000k_full_init/gcc10	     100	 9556300 ns/op	     104.719 MB/s
Benchmarkwuffs_gif_decode_1000k_full_init/gcc10	     100	 9522440 ns/op	     105.092 MB/s
Benchmarkwuffs_gif_decode_1000k_full_init/gcc10	     100	 9438460 ns/op	     106.027 MB/s
Benchmarkwuffs_gif_decode_1000k_full_init/gcc10	     100	 9477400 ns/op	     105.591 MB/s
----

On a mid-range x86_64 laptop:

wuffs_gif_decode_1k_bw/clang9                367MB/s ± 0%    347MB/s ± 0%   -5.37%  (p=0.016 n=4+5)
wuffs_gif_decode_1k_color_full_init/clang9  89.8MB/s ± 0%   90.6MB/s ± 0%   +0.83%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/clang9   107MB/s ± 0%    107MB/s ± 0%     ~     (p=0.413 n=4+5)
wuffs_gif_decode_10k_bgra/clang9             421MB/s ± 0%    420MB/s ± 0%     ~     (p=0.548 n=5+5)
wuffs_gif_decode_10k_indexed/clang9          111MB/s ± 0%    112MB/s ± 0%     ~     (p=0.056 n=5+5)
wuffs_gif_decode_20k/clang9                  134MB/s ± 0%    134MB/s ± 0%   -0.33%  (p=0.016 n=5+5)
wuffs_gif_decode_100k_artificial/clang9      301MB/s ± 0%    301MB/s ± 0%     ~     (p=0.151 n=5+5)
wuffs_gif_decode_100k_realistic/clang9       115MB/s ± 0%    115MB/s ± 0%     ~     (p=0.151 n=5+5)
wuffs_gif_decode_1000k_full_init/clang9      117MB/s ± 0%    117MB/s ± 0%   -0.17%  (p=0.016 n=5+5)
wuffs_gif_decode_1000k_part_init/clang9      117MB/s ± 1%    117MB/s ± 0%     ~     (p=0.690 n=5+5)
wuffs_gif_decode_anim_screencap/clang9       675MB/s ± 0%    674MB/s ± 0%   -0.20%  (p=0.016 n=4+5)

wuffs_gif_decode_1k_bw/gcc10                 309MB/s ± 0%    313MB/s ± 0%   +1.18%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/gcc10   85.4MB/s ± 0%  104.1MB/s ± 0%  +21.81%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/gcc10   97.9MB/s ± 0%  123.3MB/s ± 0%  +25.92%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc10              372MB/s ± 0%    447MB/s ± 0%  +19.92%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/gcc10          97.9MB/s ± 0%  119.0MB/s ± 0%  +21.54%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/gcc10                   123MB/s ± 0%    139MB/s ± 0%  +12.98%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc10       271MB/s ± 0%    293MB/s ± 0%   +8.16%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/gcc10        104MB/s ± 0%    119MB/s ± 0%  +13.90%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_full_init/gcc10       106MB/s ± 0%    121MB/s ± 0%  +14.06%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/gcc10       106MB/s ± 0%    121MB/s ± 0%  +14.24%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/gcc10        633MB/s ± 0%    653MB/s ± 0%   +3.24%  (p=0.008 n=5+5)

mimic_gif_decode_1k_bw                      84.3MB/s ± 0%   84.1MB/s ± 0%     ~     (p=0.151 n=5+5)
mimic_gif_decode_1k_color                   45.1MB/s ± 0%   45.0MB/s ± 1%     ~     (p=0.421 n=5+5)
mimic_gif_decode_10k_indexed                52.4MB/s ± 0%   52.4MB/s ± 0%     ~     (p=0.841 n=5+5)
mimic_gif_decode_20k                        52.6MB/s ± 0%   52.6MB/s ± 0%     ~     (p=0.310 n=5+5)
mimic_gif_decode_100k_artificial            82.9MB/s ± 0%   82.7MB/s ± 1%     ~     (p=0.460 n=5+5)
mimic_gif_decode_100k_realistic             51.1MB/s ± 0%   51.0MB/s ± 0%   -0.12%  (p=0.016 n=5+5)
mimic_gif_decode_1000k                      52.5MB/s ± 0%   52.4MB/s ± 0%     ~     (p=0.548 n=5+5)
mimic_gif_decode_anim_screencap             98.2MB/s ± 0%   98.1MB/s ± 0%   -0.11%  (p=0.032 n=5+5)
2021-02-02 11:32:04 +11:00
..
2019-12-20 00:47:36 +11:00
2019-12-20 00:52:23 +11:00
2020-12-15 16:23:24 +11:00

Releases (in the C Programming Language)

Wuffs the Library ships as a "single file C library", also known as a "header file library".

To use that library in your C/C++ project, you just need to copy one file from this directory, or otherwise integrate that one file into your build system. Typically, pick the latest stable version (but not the unsupported snapshot), with a filename like wuffs-vMAJOR.MINOR.c for version MAJOR.MINOR.

To use that single file as a "foo.c"-like implementation, instead of a "foo.h"-like header, #define WUFFS_IMPLEMENTATION before #include'ing or compiling it.

Latest Stable Version

Version 0.2 (December 2019) is the latest stable version. Stable means that its API won't change any further, but being a "version 0.x" means that:

  • It will not have long term support.
  • Newer versions make no promises about compatibility.