Unroll wuffs_base__pixel_swizzler__copy_4_1

It's a mystery why some non-bgra benchmarks improve (e.g. std/lzw
improves, std/deflate does not), but I'll take it.

name                                    old speed      new speed      delta

wuffs_lzw_decode_20k/clang               242MB/s ± 0%   251MB/s ± 0%  +3.75%  (p=0.008 n=5+5)
wuffs_lzw_decode_100k/clang              419MB/s ± 0%   432MB/s ± 0%  +3.16%  (p=0.008 n=5+5)

wuffs_lzw_decode_20k/gcc                 260MB/s ± 0%   264MB/s ± 0%  +1.40%  (p=0.008 n=5+5)
wuffs_lzw_decode_100k/gcc                449MB/s ± 1%   474MB/s ± 0%  +5.45%  (p=0.008 n=5+5)

wuffs_deflate_decode_1k/clang            152MB/s ± 1%   154MB/s ± 1%  +0.97%  (p=0.032 n=5+5)
wuffs_deflate_decode_10k/clang           242MB/s ± 0%   243MB/s ± 1%    ~     (p=0.548 n=5+5)
wuffs_deflate_decode_100k/clang          276MB/s ± 0%   275MB/s ± 1%    ~     (p=0.222 n=5+5)

wuffs_deflate_decode_1k/gcc              157MB/s ± 0%   156MB/s ± 1%  -0.89%  (p=0.008 n=5+5)
wuffs_deflate_decode_10k/gcc             261MB/s ± 0%   260MB/s ± 0%    ~     (p=0.222 n=5+5)
wuffs_deflate_decode_100k/gcc            317MB/s ± 0%   315MB/s ± 0%  -0.66%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/clang             242MB/s ± 0%   242MB/s ± 1%    ~     (p=0.222 n=5+5)
wuffs_gif_decode_1k_color/clang          135MB/s ± 0%   139MB/s ± 0%  +3.12%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/clang          663MB/s ± 0%   683MB/s ± 0%  +3.03%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/clang       177MB/s ± 0%   182MB/s ± 1%  +2.91%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/clang   513MB/s ± 0%   529MB/s ± 0%  +3.09%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_realistic/clang    205MB/s ± 0%   211MB/s ± 0%  +2.66%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k/clang             209MB/s ± 0%   214MB/s ± 2%  +2.62%  (p=0.008 n=5+5)
wuffs_gif_decode_anim_screencap/clang   1.05GB/s ± 0%  1.09GB/s ± 0%  +3.40%  (p=0.008 n=5+5)

wuffs_gif_decode_1k_bw/gcc               266MB/s ± 1%   265MB/s ± 0%  -0.46%  (p=0.016 n=5+5)
wuffs_gif_decode_1k_color/gcc            149MB/s ± 1%   150MB/s ± 0%  +0.93%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_bgra/gcc            597MB/s ± 1%   609MB/s ± 0%  +1.96%  (p=0.008 n=5+5)
wuffs_gif_decode_10k_indexed/gcc         186MB/s ± 0%   189MB/s ± 0%  +1.89%  (p=0.008 n=5+5)
wuffs_gif_decode_100k_artificial/gcc     520MB/s ± 0%   518MB/s ± 0%  -0.39%  (p=0.032 n=5+5)
wuffs_gif_decode_100k_realistic/gcc      212MB/s ± 0%   213MB/s ± 0%  +0.55%  (p=0.008 n=5+5)
wuffs_gif_decode_1000k/gcc               216MB/s ± 0%   217MB/s ± 0%  +0.56%  (p=0.016 n=5+5)
wuffs_gif_decode_anim_screencap/gcc     1.09GB/s ± 1%  1.09GB/s ± 0%    ~     (p=0.548 n=5+5)
This commit is contained in:
Nigel Tao committed 2018-12-26 13:40:43 +11:00
1 parent b2d598aac5
commit 80bd4061b5
3 files changed
+65 -28

No files matched your search

+30 -12
View File
@@ -4022,19 +4022,37 @@ wuffs_base__pixel_swizzler__copy_4_1(wuffs_base__slice_u8 dst,
uint8_t* s = src.ptr;
size_t n = len;
while (n--) {
uint8_t* p = dst_palette.ptr + ((size_t)(*s) * 4);
uint8_t b0 = p[0];
uint8_t b1 = p[1];
uint8_t b2 = p[2];
uint8_t b3 = p[3];
d[0] = b0;
d[1] = b1;
d[2] = b2;
d[3] = b3;
s += 1;
d += 4;
const int N = 4;
while (n >= N) {
wuffs_base__store_u32le(
d + (0 * 4),
wuffs_base__load_u32le(dst_palette.ptr + ((uint32_t)(s[0]) * 4)));
wuffs_base__store_u32le(
d + (1 * 4),
wuffs_base__load_u32le(dst_palette.ptr + ((uint32_t)(s[1]) * 4)));
wuffs_base__store_u32le(
d + (2 * 4),
wuffs_base__load_u32le(dst_palette.ptr + ((uint32_t)(s[2]) * 4)));
wuffs_base__store_u32le(
d + (3 * 4),
wuffs_base__load_u32le(dst_palette.ptr + ((uint32_t)(s[3]) * 4)));
s += 1 * N;
d += 4 * N;
n -= 1 * N;
}
while (n >= 1) {
wuffs_base__store_u32le(
d + (0 * 4),
wuffs_base__load_u32le(dst_palette.ptr + ((uint32_t)(s[0]) * 4)));
s += 1 * 1;
d += 4 * 1;
n -= 1 * 1;
}
return len;
}