Re-arrange struct fields so bulk data is last

name                                             old speed      new speed      delta

wuffs_adler32_10k/clang5                         2.42GB/s ± 1%  2.43GB/s ± 1%  +0.15%  (p=0.014 n=46+45)
wuffs_adler32_100k/clang5                        2.43GB/s ± 1%  2.43GB/s ± 1%    ~     (p=0.532 n=43+46)

wuffs_adler32_10k/gcc7                           3.22GB/s ± 0%  3.23GB/s ± 1%  +0.17%  (p=0.000 n=47+48)
wuffs_adler32_100k/gcc7                          3.23GB/s ± 0%  3.23GB/s ± 0%  +0.20%  (p=0.000 n=45+48)

wuffs_crc32_ieee_10k/clang5                      2.86GB/s ± 0%  2.86GB/s ± 0%  +0.22%  (p=0.000 n=47+46)
wuffs_crc32_ieee_100k/clang5                     2.88GB/s ± 0%  2.88GB/s ± 1%  +0.11%  (p=0.006 n=48+47)

wuffs_crc32_ieee_10k/gcc7                        3.37GB/s ± 1%  3.37GB/s ± 1%    ~     (p=0.050 n=49+48)
wuffs_crc32_ieee_100k/gcc7                       3.40GB/s ± 0%  3.40GB/s ± 1%  +0.15%  (p=0.001 n=46+48)

wuffs_deflate_decode_1k/clang5                    139MB/s ± 0%   138MB/s ± 0%  -0.44%  (p=0.000 n=45+47)
wuffs_deflate_decode_10k/clang5                   222MB/s ± 0%   233MB/s ± 1%  +4.81%  (p=0.000 n=45+47)
wuffs_deflate_decode_100k_just_one_read/clang5    260MB/s ± 1%   274MB/s ± 0%  +5.34%  (p=0.000 n=46+45)
wuffs_deflate_decode_100k_many_big_reads/clang5   218MB/s ± 0%   224MB/s ± 1%  +2.36%  (p=0.000 n=44+46)

wuffs_deflate_decode_1k/gcc7                      158MB/s ± 1%   157MB/s ± 1%  -0.23%  (p=0.000 n=44+48)
wuffs_deflate_decode_10k/gcc7                     266MB/s ± 1%   265MB/s ± 1%  -0.48%  (p=0.000 n=45+47)
wuffs_deflate_decode_100k_just_one_read/gcc7      323MB/s ± 1%   320MB/s ± 0%  -0.87%  (p=0.000 n=46+46)
wuffs_deflate_decode_100k_many_big_reads/gcc7     255MB/s ± 0%   252MB/s ± 0%  -1.04%  (p=0.000 n=42+44)

wuffs_gif_decode_1k_bw/clang5                     243MB/s ± 1%   238MB/s ± 1%  -1.74%  (p=0.000 n=49+48)
wuffs_gif_decode_1k_color/clang5                  142MB/s ± 1%   140MB/s ± 1%  -1.17%  (p=0.000 n=45+49)
wuffs_gif_decode_10k_bgra/clang5                  723MB/s ± 1%   720MB/s ± 1%  -0.37%  (p=0.000 n=48+49)
wuffs_gif_decode_10k_indexed/clang5               193MB/s ± 1%   194MB/s ± 1%  +0.23%  (p=0.002 n=49+48)
wuffs_gif_decode_20k/clang5                       245MB/s ± 1%   246MB/s ± 1%  +0.20%  (p=0.002 n=49+46)
wuffs_gif_decode_100k_artificial/clang5           542MB/s ± 1%   543MB/s ± 1%  +0.16%  (p=0.012 n=48+47)
wuffs_gif_decode_100k_realistic/clang5            227MB/s ± 1%   226MB/s ± 1%  -0.31%  (p=0.000 n=48+45)
wuffs_gif_decode_1000k/clang5                     232MB/s ± 0%   231MB/s ± 1%  -0.40%  (p=0.000 n=48+42)
wuffs_gif_decode_anim_screencap/clang5           1.08GB/s ± 1%  1.07GB/s ± 1%  -1.09%  (p=0.000 n=46+46)

wuffs_gif_decode_1k_bw/gcc7                       264MB/s ± 1%   262MB/s ± 1%  -0.81%  (p=0.000 n=50+49)
wuffs_gif_decode_1k_color/gcc7                    148MB/s ± 0%   146MB/s ± 1%  -1.60%  (p=0.000 n=47+49)
wuffs_gif_decode_10k_bgra/gcc7                    621MB/s ± 1%   618MB/s ± 1%  -0.47%  (p=0.000 n=49+49)
wuffs_gif_decode_10k_indexed/gcc7                 194MB/s ± 1%   194MB/s ± 3%    ~     (p=0.222 n=49+50)
wuffs_gif_decode_20k/gcc7                         236MB/s ± 1%   237MB/s ± 1%  +0.52%  (p=0.000 n=49+45)
wuffs_gif_decode_100k_artificial/gcc7             505MB/s ± 1%   507MB/s ± 1%  +0.36%  (p=0.000 n=46+47)
wuffs_gif_decode_100k_realistic/gcc7              210MB/s ± 1%   210MB/s ± 1%    ~     (p=0.081 n=49+42)
wuffs_gif_decode_1000k/gcc7                       213MB/s ± 1%   213MB/s ± 1%  -0.19%  (p=0.001 n=49+47)
wuffs_gif_decode_anim_screencap/gcc7             1.06GB/s ± 0%  1.05GB/s ± 1%  -1.02%  (p=0.000 n=48+47)

wuffs_gzip_decode_10k/clang5                      206MB/s ± 0%   215MB/s ± 0%  +4.52%  (p=0.000 n=49+44)
wuffs_gzip_decode_100k/clang5                     239MB/s ± 0%   250MB/s ± 0%  +4.71%  (p=0.000 n=47+46)

wuffs_gzip_decode_10k/gcc7                        250MB/s ± 1%   249MB/s ± 0%  -0.38%  (p=0.000 n=47+50)
wuffs_gzip_decode_100k/gcc7                       293MB/s ± 0%   289MB/s ± 0%  -1.28%  (p=0.000 n=45+44)

wuffs_lzw_decode_20k/clang5                       265MB/s ± 1%   265MB/s ± 0%    ~     (p=0.331 n=47+44)
wuffs_lzw_decode_100k/clang5                      452MB/s ± 1%   450MB/s ± 1%  -0.31%  (p=0.001 n=48+46)

wuffs_lzw_decode_20k/gcc7                         264MB/s ± 1%   263MB/s ± 1%  -0.49%  (p=0.000 n=48+47)
wuffs_lzw_decode_100k/gcc7                        481MB/s ± 1%   475MB/s ± 1%  -1.22%  (p=0.000 n=48+50)

wuffs_zlib_decode_10k/clang5                      202MB/s ± 0%   212MB/s ± 0%  +5.18%  (p=0.000 n=46+46)
wuffs_zlib_decode_100k/clang5                     235MB/s ± 0%   247MB/s ± 0%  +4.92%  (p=0.000 n=46+45)

wuffs_zlib_decode_10k/gcc7                        246MB/s ± 0%   246MB/s ± 0%  -0.13%  (p=0.001 n=45+47)
wuffs_zlib_decode_100k/gcc7                       289MB/s ± 0%   291MB/s ± 0%  +0.67%  (p=0.000 n=47+46)
This commit is contained in:
Nigel Tao committed 2019-02-09 10:35:48 +11:00
1 parent 463079dd50
commit 2928806ab6
5 files changed
+42 -34

No files matched your search

+16 -16
View File
@@ -2699,12 +2699,12 @@ struct wuffs_deflate__decoder__struct {
uint32_t f_bits;
uint32_t f_n_bits;
uint32_t f_history_index;
bool f_end_of_block;
uint32_t f_huffs[2][1024];
uint32_t f_n_huffs_bits[2];
uint8_t f_history[32768];
uint32_t f_history_index;
uint8_t f_code_lengths[320];
bool f_end_of_block;
struct {
uint32_t coro_susp_point;
@@ -3107,11 +3107,11 @@ struct wuffs_gif__decoder__struct {
wuffs_base__range_ie_u32 f_dirty_y;
uint64_t f_compressed_ri;
uint64_t f_compressed_wi;
wuffs_base__pixel_swizzler f_swizzler;
wuffs_lzw__decoder f_lzw;
uint8_t f_compressed[4096];
uint8_t f_palettes[2][1024];
uint8_t f_dst_palette[1024];
wuffs_base__pixel_swizzler f_swizzler;
wuffs_lzw__decoder f_lzw;
struct {
uint32_t coro_susp_point;
@@ -3350,9 +3350,9 @@ struct wuffs_gzip__decoder__struct {
uint32_t magic;
uint32_t active_coroutine;
wuffs_deflate__decoder f_flate;
wuffs_crc32__ieee_hasher f_checksum;
bool f_ignore_checksum;
wuffs_crc32__ieee_hasher f_checksum;
wuffs_deflate__decoder f_flate;
struct {
uint32_t coro_susp_point;
@@ -3502,9 +3502,9 @@ struct wuffs_zlib__decoder__struct {
uint32_t magic;
uint32_t active_coroutine;
wuffs_deflate__decoder f_flate;
wuffs_adler32__hasher f_checksum;
bool f_ignore_checksum;
wuffs_adler32__hasher f_checksum;
wuffs_deflate__decoder f_flate;
struct {
uint32_t coro_susp_point;
@@ -10488,16 +10488,16 @@ wuffs_gzip__decoder__check_wuffs_version(wuffs_gzip__decoder* self,
return wuffs_base__error__check_wuffs_version_not_applicable;
}
{
wuffs_base__status z = wuffs_deflate__decoder__check_wuffs_version(
&self->private_impl.f_flate, sizeof(self->private_impl.f_flate),
wuffs_base__status z = wuffs_crc32__ieee_hasher__check_wuffs_version(
&self->private_impl.f_checksum, sizeof(self->private_impl.f_checksum),
WUFFS_VERSION);
if (z) {
return z;
}
}
{
wuffs_base__status z = wuffs_crc32__ieee_hasher__check_wuffs_version(
&self->private_impl.f_checksum, sizeof(self->private_impl.f_checksum),
wuffs_base__status z = wuffs_deflate__decoder__check_wuffs_version(
&self->private_impl.f_flate, sizeof(self->private_impl.f_flate),
WUFFS_VERSION);
if (z) {
return z;
@@ -10951,16 +10951,16 @@ wuffs_zlib__decoder__check_wuffs_version(wuffs_zlib__decoder* self,
return wuffs_base__error__check_wuffs_version_not_applicable;
}
{
wuffs_base__status z = wuffs_deflate__decoder__check_wuffs_version(
&self->private_impl.f_flate, sizeof(self->private_impl.f_flate),
wuffs_base__status z = wuffs_adler32__hasher__check_wuffs_version(
&self->private_impl.f_checksum, sizeof(self->private_impl.f_checksum),
WUFFS_VERSION);
if (z) {
return z;
}
}
{
wuffs_base__status z = wuffs_adler32__hasher__check_wuffs_version(
&self->private_impl.f_checksum, sizeof(self->private_impl.f_checksum),
wuffs_base__status z = wuffs_deflate__decoder__check_wuffs_version(
&self->private_impl.f_flate, sizeof(self->private_impl.f_flate),
WUFFS_VERSION);
if (z) {
return z;
+9 -7
View File
@@ -64,6 +64,14 @@ pub struct decoder?(
bits base.u32,
n_bits base.u32,
// history_index indexes the history array, defined below.
history_index base.u32,
// end_of_block is whether decode_huffman_xxx saw an end-of-block code.
//
// TODO: can decode_huffman_xxx signal this in band instead of out of band?
end_of_block base.bool,
// huffs and n_huffs_bits are the lookup tables for Huffman decodings.
//
// There are up to 2 Huffman decoders active at any one time. As per this
@@ -108,8 +116,7 @@ pub struct decoder?(
//
// history[history_index & 0x7FFF] is where the next byte of decoded output
// will be written.
history array[0x8000] base.u8, // 32 KiB.
history_index base.u32,
history array[0x8000] base.u8, // 32 KiB.
// code_lengths is used to pass out-of-band data to init_huff.
//
@@ -117,11 +124,6 @@ pub struct decoder?(
// code.
code_lengths array[320] base.u8[..15],
// end_of_block is whether decode_huffman_xxx saw an end-of-block code.
//
// TODO: can decode_huffman_xxx signal this in band instead of out of band?
end_of_block base.bool,
util base.utility,
)
+7 -5
View File
@@ -110,18 +110,20 @@ pub struct decoder?(
dst_y base.u32,
dirty_y base.range_ie_u32,
// Indexes into the compressed array, defined below.
compressed_ri base.u64,
compressed_wi base.u64,
compressed array[4096] base.u8,
swizzler base.pixel_swizzler,
util base.utility,
lzw lzw.decoder,
compressed array[4096] base.u8,
// palettes[0] and palettes[1] are the Global and Local Color Table.
palettes array[2] array[4 * 256] base.u8,
// dst_palette is the swizzled color table.
dst_palette array[4 * 256] base.u8,
swizzler base.pixel_swizzler,
util base.utility,
lzw lzw.decoder,
)
pub func decoder.decode_image_config?(dst nptr base.image_config, src base.io_reader) {
+5 -3
View File
@@ -24,10 +24,12 @@ pub status "?bad header"
pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 32768 + 512
pub struct decoder?(
flate deflate.decoder,
checksum crc32.ieee_hasher,
ignore_checksum base.bool,
util base.utility,
checksum crc32.ieee_hasher,
flate deflate.decoder,
util base.utility,
)
pub func decoder.set_ignore_checksum!(ic base.bool) {
+5 -3
View File
@@ -26,10 +26,12 @@ pri status "?TODO: unsupported preset dictionary"
pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 32768 + 512
pub struct decoder?(
flate deflate.decoder,
checksum adler32.hasher,
ignore_checksum base.bool,
util base.utility,
checksum adler32.hasher,
flate deflate.decoder,
util base.utility,
)
pub func decoder.set_ignore_checksum!(ic base.bool) {