Roll back 0c7a8cc0 re do_bench_image_decode

Commit 0c7a8cc029 is "Have
do_bench_image_decode pass a non-NULL dst". Adding a mandatory memcpy to
do_bench_image_decode noticably slowed down the bench numbers. Removing
the memcpy speeds it back up.

wuffs_gif_decode_1k_bw/clang9                278MB/s ± 0%   373MB/s ± 0%  +34.42%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/clang9  85.0MB/s ± 0%  91.1MB/s ± 0%   +7.27%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/clang9   104MB/s ± 0%   114MB/s ± 0%   +9.51%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/clang9             434MB/s ± 0%   449MB/s ± 0%   +3.59%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/clang9          115MB/s ± 0%   120MB/s ± 0%   +4.63%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/clang9                  140MB/s ± 1%   145MB/s ± 0%   +3.16%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang9      301MB/s ± 0%   312MB/s ± 0%   +3.62%  (p=0.016 n=5+4)
wuffs_gif_decode_100k_realistic/clang9       125MB/s ± 0%   127MB/s ± 0%   +1.40%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_full_init/clang9      128MB/s ± 0%   129MB/s ± 0%   +0.78%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/clang9      128MB/s ± 0%   128MB/s ± 1%     ~     (p=0.151 n=5+5)
wuffs_gif_decode_anim_screencap/clang9       586MB/s ± 0%   671MB/s ± 0%  +14.60%  (p=0.016 n=5+4)

wuffs_gif_decode_1k_bw/gcc10                 271MB/s ± 0%   322MB/s ± 0%  +18.81%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_full_init/gcc10   94.8MB/s ± 0%  99.2MB/s ± 1%   +4.64%  (p=0.008 n=5+5)
wuffs_gif_decode_1k_color_part_init/gcc10    116MB/s ± 0%   123MB/s ± 0%   +5.90%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc10              374MB/s ± 0%   382MB/s ± 1%   +2.12%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/gcc10           116MB/s ± 1%   119MB/s ± 0%   +3.09%  (p=0.008 n=5+5)
wuffs_gif_decode_20k/gcc10                   137MB/s ± 0%   139MB/s ± 0%   +1.46%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc10       286MB/s ± 0%   293MB/s ± 0%   +2.49%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/gcc10        118MB/s ± 0%   119MB/s ± 0%   +0.80%  (p=0.016 n=5+4)
wuffs_gif_decode_1000k_full_init/gcc10       121MB/s ± 0%   121MB/s ± 0%   +0.33%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k_part_init/gcc10       121MB/s ± 0%   121MB/s ± 0%   +0.28%  (p=0.016 n=5+5)
wuffs_gif_decode_anim_screencap/gcc10        582MB/s ± 0%   659MB/s ± 0%  +13.25%  (p=0.008 n=5+5)

wuffs_png_decode_19k_8bpp/clang9            88.7MB/s ± 0%  94.2MB/s ± 0%   +6.28%  (p=0.008 n=5+5)
wuffs_png_decode_40k_24bpp/clang9            104MB/s ± 0%   108MB/s ± 0%   +3.96%  (p=0.008 n=5+5)
wuffs_png_decode_77k_8bpp/clang9             335MB/s ± 0%   352MB/s ± 0%   +5.29%  (p=0.008 n=5+5)
wuffs_png_decode_552k_32bpp/clang9           118MB/s ± 0%   119MB/s ± 0%   +0.54%  (p=0.008 n=5+5)
wuffs_png_decode_4002k_24bpp/clang9          109MB/s ± 0%   112MB/s ± 0%   +2.36%  (p=0.008 n=5+5)

wuffs_png_decode_19k_8bpp/gcc10             96.7MB/s ± 0%  98.0MB/s ± 0%   +1.36%  (p=0.029 n=4+4)
wuffs_png_decode_40k_24bpp/gcc10             114MB/s ± 0%   115MB/s ± 0%   +0.79%  (p=0.008 n=5+5)
wuffs_png_decode_77k_8bpp/gcc10              316MB/s ± 0%   320MB/s ± 0%   +1.18%  (p=0.016 n=5+4)
wuffs_png_decode_552k_32bpp/gcc10            149MB/s ± 0%   149MB/s ± 0%   +0.17%  (p=0.016 n=5+4)
wuffs_png_decode_4002k_24bpp/gcc10           116MB/s ± 0%   116MB/s ± 0%   +0.09%  (p=0.032 n=5+5)
This commit is contained in:
Nigel Tao committed 2020-12-29 21:29:32 +11:00
1 parent 0976467a32
commit 10e8ee5e79
3 files changed
+24 -12

No files matched your search

+12 -8
View File
@@ -73,15 +73,19 @@ mimic_gif_decode(uint64_t* n_bytes_out,
// further complicates supporting both versions 4 and 5 of giflib. That
// commit was therefore rolled back.
struct SavedImage* si = &f->SavedImages[i];
size_t n = (size_t)(si->ImageDesc.Width) * (size_t)(si->ImageDesc.Height);
if (n > wuffs_base__io_buffer__writer_length(dst)) {
ret = "GIF image's pixel data won't fit in the dst buffer";
goto cleanup1;
}
memmove(wuffs_base__io_buffer__writer_pointer(dst), si->RasterBits, n);
dst->meta.wi += n;
size_t num_src =
(size_t)(si->ImageDesc.Width) * (size_t)(si->ImageDesc.Height);
if (n_bytes_out) {
*n_bytes_out += n;
*n_bytes_out += num_src;
}
if (dst) {
size_t num_dst = dst->data.len - dst->meta.wi;
if (num_dst < num_src) {
ret = "GIF image's pixel data won't fit in the dst buffer";
goto cleanup1;
}
memmove(dst->data.ptr + dst->meta.wi, si->RasterBits, num_src);
dst->meta.wi += num_src;
}
}
+11
View File
@@ -20,6 +20,17 @@ mimic_png_decode(uint64_t* n_bytes_out,
uint32_t wuffs_initialize_flags,
wuffs_base__pixel_format pixfmt,
wuffs_base__io_buffer* src) {
static uint8_t dst_fallback_array_u8[64 * 1024 * 1024];
wuffs_base__io_buffer dst_fallback = ((wuffs_base__io_buffer){
.data = ((wuffs_base__slice_u8){
.ptr = dst_fallback_array_u8,
.len = 64 * 1024 * 1024,
}),
});
if (!dst) {
dst = &dst_fallback;
}
const char* ret = NULL;
png_image pi;
+1 -4
View File
@@ -1120,12 +1120,9 @@ do_bench_image_decode(
uint64_t i;
uint64_t iters = iters_unscaled * g_flags.iterscale;
for (i = 0; i < iters; i++) {
wuffs_base__io_buffer dst = ((wuffs_base__io_buffer){
.data = g_pixel_slice_u8,
});
src.meta.ri = src_ri;
CHECK_STRING(
(*decode_func)(&n_bytes, &dst, wuffs_initialize_flags, pixfmt, &src));
(*decode_func)(&n_bytes, NULL, wuffs_initialize_flags, pixfmt, &src));
}
bench_finish(iters, n_bytes);
return NULL;