mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 00:52:18 +01:00
Reduce the deflate decoder Huffman table size
name old speed new speed delta wuffs_deflate_decode_1k/clang5 138MB/s ± 0% 140MB/s ± 1% +1.16% (p=0.008 n=5+5) wuffs_deflate_decode_10k/clang5 228MB/s ± 1% 229MB/s ± 1% ~ (p=0.222 n=5+5) wuffs_deflate_decode_100k_just_one_read/clang5 267MB/s ± 1% 267MB/s ± 1% ~ (p=0.690 n=5+5) wuffs_deflate_decode_100k_many_big_reads/clang5 225MB/s ± 0% 225MB/s ± 0% ~ (p=0.310 n=5+5) wuffs_deflate_decode_1k/gcc7 157MB/s ± 0% 157MB/s ± 0% ~ (p=0.730 n=4+5) wuffs_deflate_decode_10k/gcc7 269MB/s ± 0% 269MB/s ± 1% ~ (p=0.222 n=5+5) wuffs_deflate_decode_100k_just_one_read/gcc7 321MB/s ± 0% 321MB/s ± 1% ~ (p=0.548 n=5+5) wuffs_deflate_decode_100k_many_big_reads/gcc7 254MB/s ± 0% 254MB/s ± 0% ~ (p=0.421 n=5+5) wuffs_gzip_decode_10k/clang5 205MB/s ± 0% 212MB/s ± 0% +3.50% (p=0.016 n=5+4) wuffs_gzip_decode_100k/clang5 238MB/s ± 0% 245MB/s ± 0% +3.31% (p=0.008 n=5+5) wuffs_gzip_decode_10k/gcc7 247MB/s ± 0% 248MB/s ± 0% +0.47% (p=0.016 n=5+5) wuffs_gzip_decode_100k/gcc7 293MB/s ± 1% 293MB/s ± 0% ~ (p=0.690 n=5+5) wuffs_zlib_decode_10k/clang5 210MB/s ± 0% 210MB/s ± 0% ~ (p=0.056 n=5+5) wuffs_zlib_decode_100k/clang5 244MB/s ± 0% 244MB/s ± 0% ~ (p=0.556 n=4+5) wuffs_zlib_decode_10k/gcc7 247MB/s ± 0% 249MB/s ± 1% +0.77% (p=0.008 n=5+5) wuffs_zlib_decode_100k/gcc7 288MB/s ± 0% 288MB/s ± 0% ~ (p=1.000 n=5+5)
This commit is contained in:
1 parent
670b45be53
commit
92f3958a28
4 files changed
+16
-16
No files matched your search
@@ -2533,7 +2533,7 @@ struct wuffs_deflate__decoder__struct {
|
||||
|
||||
uint32_t f_bits;
|
||||
uint32_t f_n_bits;
|
||||
uint32_t f_huffs[2][1234];
|
||||
uint32_t f_huffs[2][1024];
|
||||
uint32_t f_n_huffs_bits[2];
|
||||
uint8_t f_history[32768];
|
||||
uint32_t f_history_index;
|
||||
@@ -5436,7 +5436,7 @@ static const uint32_t wuffs_deflate__dcode_magic_numbers[32] = {
|
||||
134217728, 134217728,
|
||||
};
|
||||
|
||||
static const uint32_t wuffs_deflate__huffs_table_size = 1234;
|
||||
static const uint32_t wuffs_deflate__huffs_table_size = 1024;
|
||||
|
||||
// ---------------- Private Initializer Prototypes
|
||||
|
||||
@@ -6432,7 +6432,7 @@ label_1_break:;
|
||||
v_j -= 9;
|
||||
v_initial_high_bits = (((uint32_t)(1)) << v_j);
|
||||
v_top = v_next_top;
|
||||
if ((v_top + (((uint32_t)(1)) << v_j)) > 1234) {
|
||||
if ((v_top + (((uint32_t)(1)) << v_j)) > 1024) {
|
||||
return wuffs_deflate__error__internal_error_inconsistent_huffman_decoder_state;
|
||||
}
|
||||
v_next_top = (v_top + (((uint32_t)(1)) << v_j));
|
||||
@@ -6469,7 +6469,7 @@ label_1_break:;
|
||||
v_delta = (((uint32_t)(1)) << v_cl);
|
||||
while (v_high_bits >= v_delta) {
|
||||
v_high_bits -= v_delta;
|
||||
if ((v_top + ((v_high_bits | v_reversed_key) & 511)) >= 1234) {
|
||||
if ((v_top + ((v_high_bits | v_reversed_key) & 511)) >= 1024) {
|
||||
return wuffs_deflate__error__internal_error_inconsistent_huffman_decoder_state;
|
||||
}
|
||||
self->private_impl
|
||||
@@ -6593,7 +6593,7 @@ label_0_continue:;
|
||||
}
|
||||
v_redir_top = ((v_table_entry >> 8) & 65535);
|
||||
v_redir_mask = ((((uint32_t)(1)) << ((v_table_entry >> 4) & 15)) - 1);
|
||||
if ((v_redir_top + (v_bits & v_redir_mask)) >= 1234) {
|
||||
if ((v_redir_top + (v_bits & v_redir_mask)) >= 1024) {
|
||||
status =
|
||||
wuffs_deflate__error__internal_error_inconsistent_huffman_decoder_state;
|
||||
goto exit;
|
||||
@@ -6678,7 +6678,7 @@ label_0_continue:;
|
||||
}
|
||||
v_redir_top = ((v_table_entry >> 8) & 65535);
|
||||
v_redir_mask = ((((uint32_t)(1)) << ((v_table_entry >> 4) & 15)) - 1);
|
||||
if ((v_redir_top + (v_bits & v_redir_mask)) >= 1234) {
|
||||
if ((v_redir_top + (v_bits & v_redir_mask)) >= 1024) {
|
||||
status =
|
||||
wuffs_deflate__error__internal_error_inconsistent_huffman_decoder_state;
|
||||
goto exit;
|
||||
@@ -6938,7 +6938,7 @@ wuffs_deflate__decoder__decode_huffman_slow(wuffs_deflate__decoder* self,
|
||||
v_redir_top = ((v_table_entry >> 8) & 65535);
|
||||
v_redir_mask = ((((uint32_t)(1)) << ((v_table_entry >> 4) & 15)) - 1);
|
||||
while (true) {
|
||||
if ((v_redir_top + (v_bits & v_redir_mask)) >= 1234) {
|
||||
if ((v_redir_top + (v_bits & v_redir_mask)) >= 1024) {
|
||||
status =
|
||||
wuffs_deflate__error__internal_error_inconsistent_huffman_decoder_state;
|
||||
goto exit;
|
||||
@@ -7046,7 +7046,7 @@ wuffs_deflate__decoder__decode_huffman_slow(wuffs_deflate__decoder* self,
|
||||
v_redir_top = ((v_table_entry >> 8) & 65535);
|
||||
v_redir_mask = ((((uint32_t)(1)) << ((v_table_entry >> 4) & 15)) - 1);
|
||||
while (true) {
|
||||
if ((v_redir_top + (v_bits & v_redir_mask)) >= 1234) {
|
||||
if ((v_redir_top + (v_bits & v_redir_mask)) >= 1024) {
|
||||
status =
|
||||
wuffs_deflate__error__internal_error_inconsistent_huffman_decoder_state;
|
||||
goto exit;
|
||||
|
||||
Reference in new issue
Block a user