mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 08:47:28 +01:00
std/*io_transformer*: add "#truncated input"
name old speed new speed delta wuffs_bzip2_decode_10k/clang11 58.5MB/s ± 0% 59.9MB/s ± 0% +2.50% (p=0.008 n=5+5) wuffs_bzip2_decode_100k/clang11 45.7MB/s ± 0% 50.5MB/s ± 0% +10.66% (p=0.008 n=5+5) wuffs_bzip2_decode_10k/gcc10 56.2MB/s ± 0% 61.9MB/s ± 0% +10.01% (p=0.008 n=5+5) wuffs_bzip2_decode_100k/gcc10 46.5MB/s ± 0% 50.4MB/s ± 0% +8.41% (p=0.016 n=4+5) wuffs_deflate_decode_1k_full_init/clang11 195MB/s ± 0% 191MB/s ± 0% -1.71% (p=0.008 n=5+5) wuffs_deflate_decode_1k_part_init/clang11 224MB/s ± 0% 225MB/s ± 0% +0.87% (p=0.008 n=5+5) wuffs_deflate_decode_10k_full_init/clang11 421MB/s ± 0% 401MB/s ± 0% -4.59% (p=0.008 n=5+5) wuffs_deflate_decode_10k_part_init/clang11 432MB/s ± 0% 413MB/s ± 0% -4.49% (p=0.008 n=5+5) wuffs_deflate_decode_100k_just_one_read/clang11 542MB/s ± 0% 518MB/s ± 0% -4.43% (p=0.008 n=5+5) wuffs_deflate_decode_100k_many_big_reads/clang11 338MB/s ± 0% 325MB/s ± 0% -3.81% (p=0.008 n=5+5) wuffs_deflate_decode_1k_full_init/gcc10 181MB/s ± 0% 185MB/s ± 0% +1.76% (p=0.008 n=5+5) wuffs_deflate_decode_1k_part_init/gcc10 209MB/s ± 0% 212MB/s ± 0% +1.79% (p=0.008 n=5+5) wuffs_deflate_decode_10k_full_init/gcc10 410MB/s ± 0% 407MB/s ± 0% -0.93% (p=0.008 n=5+5) wuffs_deflate_decode_10k_part_init/gcc10 421MB/s ± 0% 418MB/s ± 0% -0.87% (p=0.008 n=5+5) wuffs_deflate_decode_100k_just_one_read/gcc10 533MB/s ± 0% 533MB/s ± 0% ~ (p=0.548 n=5+5) wuffs_deflate_decode_100k_many_big_reads/gcc10 336MB/s ± 0% 334MB/s ± 1% -0.67% (p=0.008 n=5+5) wuffs_gzip_decode_10k/clang11 401MB/s ± 0% 398MB/s ± 0% -0.77% (p=0.008 n=5+5) wuffs_gzip_decode_100k/clang11 505MB/s ± 0% 503MB/s ± 0% -0.46% (p=0.008 n=5+5) wuffs_gzip_decode_10k/gcc10 403MB/s ± 0% 410MB/s ± 0% +1.90% (p=0.008 n=5+5) wuffs_gzip_decode_100k/gcc10 522MB/s ± 0% 523MB/s ± 0% +0.10% (p=0.032 n=5+5) wuffs_zlib_decode_10k/clang11 418MB/s ± 0% 417MB/s ± 1% ~ (p=0.310 n=5+5) wuffs_zlib_decode_100k/clang11 530MB/s ± 0% 529MB/s ± 0% ~ (p=0.421 n=5+5) wuffs_zlib_decode_10k/gcc10 428MB/s ± 0% 434MB/s ± 0% +1.50% (p=0.008 n=5+5) wuffs_zlib_decode_100k/gcc10 551MB/s ± 0% 551MB/s ± 0% ~ (p=0.690 n=5+5) Fixes #96
This commit is contained in:
1 parent
d7c48ae76b
commit
f01f0859f0
9 files changed
+544
-71
No files matched your search
@@ -109,6 +109,36 @@ test_wuffs_bzip2_decode_interface() {
|
||||
"test/data/romeo.txt.bz2", 0, SIZE_MAX, 942, 0x0A);
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_wuffs_bzip2_decode_truncated_input() {
|
||||
CHECK_FOCUS(__func__);
|
||||
|
||||
wuffs_base__io_buffer have = wuffs_base__ptr_u8__writer(g_have_array_u8, 1);
|
||||
wuffs_base__io_buffer src =
|
||||
wuffs_base__ptr_u8__reader(g_src_array_u8, 0, false);
|
||||
wuffs_bzip2__decoder dec;
|
||||
CHECK_STATUS("initialize",
|
||||
wuffs_bzip2__decoder__initialize(
|
||||
&dec, sizeof dec, WUFFS_VERSION,
|
||||
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
|
||||
|
||||
wuffs_base__status status =
|
||||
wuffs_bzip2__decoder__transform_io(&dec, &have, &src, g_work_slice_u8);
|
||||
if (status.repr != wuffs_base__suspension__short_read) {
|
||||
RETURN_FAIL("closed=false: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_base__suspension__short_read);
|
||||
}
|
||||
|
||||
src.meta.closed = true;
|
||||
status =
|
||||
wuffs_bzip2__decoder__transform_io(&dec, &have, &src, g_work_slice_u8);
|
||||
if (status.repr != wuffs_bzip2__error__truncated_input) {
|
||||
RETURN_FAIL("closed=true: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_bzip2__error__truncated_input);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* //
|
||||
wuffs_bzip2_decode(wuffs_base__io_buffer* dst,
|
||||
wuffs_base__io_buffer* src,
|
||||
@@ -262,6 +292,7 @@ proc g_tests[] = {
|
||||
test_wuffs_bzip2_decode_interface,
|
||||
test_wuffs_bzip2_decode_midsummer,
|
||||
test_wuffs_bzip2_decode_pi,
|
||||
test_wuffs_bzip2_decode_truncated_input,
|
||||
|
||||
#ifdef WUFFS_MIMIC
|
||||
|
||||
|
||||
@@ -166,6 +166,36 @@ test_wuffs_deflate_decode_interface() {
|
||||
"test/data/romeo.txt.deflate", 0, SIZE_MAX, 942, 0x0A);
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_wuffs_deflate_decode_truncated_input() {
|
||||
CHECK_FOCUS(__func__);
|
||||
|
||||
wuffs_base__io_buffer have = wuffs_base__ptr_u8__writer(g_have_array_u8, 1);
|
||||
wuffs_base__io_buffer src =
|
||||
wuffs_base__ptr_u8__reader(g_src_array_u8, 0, false);
|
||||
wuffs_deflate__decoder dec;
|
||||
CHECK_STATUS("initialize",
|
||||
wuffs_deflate__decoder__initialize(
|
||||
&dec, sizeof dec, WUFFS_VERSION,
|
||||
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
|
||||
|
||||
wuffs_base__status status =
|
||||
wuffs_deflate__decoder__transform_io(&dec, &have, &src, g_work_slice_u8);
|
||||
if (status.repr != wuffs_base__suspension__short_read) {
|
||||
RETURN_FAIL("closed=false: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_base__suspension__short_read);
|
||||
}
|
||||
|
||||
src.meta.closed = true;
|
||||
status =
|
||||
wuffs_deflate__decoder__transform_io(&dec, &have, &src, g_work_slice_u8);
|
||||
if (status.repr != wuffs_deflate__error__truncated_input) {
|
||||
RETURN_FAIL("closed=true: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_deflate__error__truncated_input);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* //
|
||||
wuffs_deflate_decode(wuffs_base__io_buffer* dst,
|
||||
wuffs_base__io_buffer* src,
|
||||
@@ -903,6 +933,7 @@ proc g_tests[] = {
|
||||
test_wuffs_deflate_decode_romeo,
|
||||
test_wuffs_deflate_decode_romeo_fixed,
|
||||
test_wuffs_deflate_decode_split_src,
|
||||
test_wuffs_deflate_decode_truncated_input,
|
||||
test_wuffs_deflate_history_full,
|
||||
test_wuffs_deflate_history_partial,
|
||||
test_wuffs_deflate_table_redirect,
|
||||
|
||||
@@ -96,6 +96,36 @@ test_wuffs_gzip_decode_interface() {
|
||||
"test/data/romeo.txt.gz", 0, SIZE_MAX, 942, 0x0A);
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_wuffs_gzip_decode_truncated_input() {
|
||||
CHECK_FOCUS(__func__);
|
||||
|
||||
wuffs_base__io_buffer have = wuffs_base__ptr_u8__writer(g_have_array_u8, 1);
|
||||
wuffs_base__io_buffer src =
|
||||
wuffs_base__ptr_u8__reader(g_src_array_u8, 0, false);
|
||||
wuffs_gzip__decoder dec;
|
||||
CHECK_STATUS("initialize",
|
||||
wuffs_gzip__decoder__initialize(
|
||||
&dec, sizeof dec, WUFFS_VERSION,
|
||||
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
|
||||
|
||||
wuffs_base__status status =
|
||||
wuffs_gzip__decoder__transform_io(&dec, &have, &src, g_work_slice_u8);
|
||||
if (status.repr != wuffs_base__suspension__short_read) {
|
||||
RETURN_FAIL("closed=false: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_base__suspension__short_read);
|
||||
}
|
||||
|
||||
src.meta.closed = true;
|
||||
status =
|
||||
wuffs_gzip__decoder__transform_io(&dec, &have, &src, g_work_slice_u8);
|
||||
if (status.repr != wuffs_gzip__error__truncated_input) {
|
||||
RETURN_FAIL("closed=true: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_gzip__error__truncated_input);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* //
|
||||
wuffs_gzip_decode(wuffs_base__io_buffer* dst,
|
||||
wuffs_base__io_buffer* src,
|
||||
@@ -255,6 +285,7 @@ test_wuffs_gzip_decode_infrequent_compaction() {
|
||||
// Decode 5 source bytes at a time. Compact every 15 source bytes.
|
||||
for (size_t i = 0; i < src.data.len; i += 5) {
|
||||
src.meta.wi = i;
|
||||
src.meta.closed = false;
|
||||
wuffs_base__status status =
|
||||
wuffs_gzip__decoder__transform_io(&dec, &dst, &src, g_work_slice_u8);
|
||||
if (status.repr != wuffs_base__suspension__short_read) {
|
||||
@@ -361,6 +392,7 @@ proc g_tests[] = {
|
||||
test_wuffs_gzip_decode_interface,
|
||||
test_wuffs_gzip_decode_midsummer,
|
||||
test_wuffs_gzip_decode_pi,
|
||||
test_wuffs_gzip_decode_truncated_input,
|
||||
|
||||
#ifdef WUFFS_MIMIC
|
||||
|
||||
|
||||
@@ -112,6 +112,36 @@ test_wuffs_zlib_decode_interface() {
|
||||
"test/data/romeo.txt.zlib", 0, SIZE_MAX, 942, 0x0A);
|
||||
}
|
||||
|
||||
const char* //
|
||||
test_wuffs_zlib_decode_truncated_input() {
|
||||
CHECK_FOCUS(__func__);
|
||||
|
||||
wuffs_base__io_buffer have = wuffs_base__ptr_u8__writer(g_have_array_u8, 1);
|
||||
wuffs_base__io_buffer src =
|
||||
wuffs_base__ptr_u8__reader(g_src_array_u8, 0, false);
|
||||
wuffs_zlib__decoder dec;
|
||||
CHECK_STATUS("initialize",
|
||||
wuffs_zlib__decoder__initialize(
|
||||
&dec, sizeof dec, WUFFS_VERSION,
|
||||
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
|
||||
|
||||
wuffs_base__status status =
|
||||
wuffs_zlib__decoder__transform_io(&dec, &have, &src, g_work_slice_u8);
|
||||
if (status.repr != wuffs_base__suspension__short_read) {
|
||||
RETURN_FAIL("closed=false: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_base__suspension__short_read);
|
||||
}
|
||||
|
||||
src.meta.closed = true;
|
||||
status =
|
||||
wuffs_zlib__decoder__transform_io(&dec, &have, &src, g_work_slice_u8);
|
||||
if (status.repr != wuffs_zlib__error__truncated_input) {
|
||||
RETURN_FAIL("closed=true: have \"%s\", want \"%s\"", status.repr,
|
||||
wuffs_zlib__error__truncated_input);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* //
|
||||
wuffs_raw_deflate_decode(wuffs_base__io_buffer* dst,
|
||||
wuffs_base__io_buffer* src,
|
||||
@@ -426,6 +456,7 @@ proc g_tests[] = {
|
||||
test_wuffs_zlib_decode_pi,
|
||||
test_wuffs_zlib_decode_raw_deflate_romeo,
|
||||
test_wuffs_zlib_decode_sheep,
|
||||
test_wuffs_zlib_decode_truncated_input,
|
||||
|
||||
#ifdef WUFFS_MIMIC
|
||||
|
||||
|
||||
Reference in new issue
Block a user