Re-introduce reader1.use_limit.

The std/flate benchmarks get better. The std/gif benchmarks get worse,
but that's possibly because the PUFFS_USE_NO_OP_PERFORMANCE_HACKS hacks
are fragile.

name                             old speed      new speed      delta

puffs_adler32_10k/clang          2.45GB/s ± 0%  2.45GB/s ± 0%     ~     (p=0.310 n=5+5)
puffs_adler32_100k/clang         2.46GB/s ± 0%  2.46GB/s ± 0%     ~     (p=0.690 n=5+5)
puffs_flate_decode_1k/clang       113MB/s ± 0%   113MB/s ± 0%     ~     (p=0.690 n=5+5)
puffs_flate_decode_10k/clang      140MB/s ± 0%   140MB/s ± 0%     ~     (p=0.222 n=5+5)
puffs_flate_decode_100k/clang     151MB/s ± 0%   151MB/s ± 0%     ~     (p=0.095 n=5+5)
puffs_zlib_decode_10k/clang       132MB/s ± 1%   132MB/s ± 0%     ~     (p=0.548 n=5+5)
puffs_zlib_decode_100k/clang      143MB/s ± 0%   143MB/s ± 0%     ~     (p=0.730 n=5+4)

puffs_adler32_10k/gcc            3.26GB/s ± 0%  3.26GB/s ± 0%     ~     (p=0.548 n=5+5)
puffs_adler32_100k/gcc           3.27GB/s ± 0%  3.27GB/s ± 0%     ~     (p=0.841 n=5+5)
puffs_flate_decode_1k/gcc         108MB/s ± 0%   125MB/s ± 0%  +14.97%  (p=0.008 n=5+5)
puffs_flate_decode_10k/gcc        128MB/s ± 0%   148MB/s ± 0%  +15.48%  (p=0.016 n=4+5)
puffs_flate_decode_100k/gcc       136MB/s ± 0%   158MB/s ± 0%  +16.40%  (p=0.008 n=5+5)
puffs_zlib_decode_10k/gcc         123MB/s ± 0%   141MB/s ± 0%  +14.70%  (p=0.016 n=4+5)
puffs_zlib_decode_100k/gcc        131MB/s ± 0%   151MB/s ± 0%  +15.60%  (p=0.016 n=5+4)

puffs_gif_lzw_decode_20k/clang    131MB/s ± 1%   128MB/s ± 3%   -2.04%  (p=0.032 n=5+5)
puffs_gif_lzw_decode_100k/clang   172MB/s ± 1%   173MB/s ± 1%     ~     (p=0.151 n=5+5)
puffs_gif_decode_1k/clang         351MB/s ± 3%   341MB/s ± 5%     ~     (p=0.310 n=5+5)
puffs_gif_decode_10k/clang        138MB/s ± 1%   134MB/s ± 3%   -3.34%  (p=0.008 n=5+5)
puffs_gif_decode_100k/clang       122MB/s ± 2%   122MB/s ± 2%     ~     (p=1.000 n=5+5)
puffs_gif_decode_1000k/clang      126MB/s ± 1%   122MB/s ± 4%   -3.07%  (p=0.016 n=5+5)

puffs_gif_lzw_decode_20k/gcc      140MB/s ± 3%   140MB/s ± 3%     ~     (p=0.421 n=5+5)
puffs_gif_lzw_decode_100k/gcc     187MB/s ± 2%   184MB/s ± 1%     ~     (p=0.056 n=5+5)
puffs_gif_decode_1k/gcc           401MB/s ± 1%   357MB/s ± 1%  -10.88%  (p=0.008 n=5+5)
puffs_gif_decode_10k/gcc          154MB/s ± 1%   126MB/s ± 1%  -18.42%  (p=0.008 n=5+5)
puffs_gif_decode_100k/gcc         131MB/s ± 2%   109MB/s ± 0%  -17.37%  (p=0.008 n=5+5)
puffs_gif_decode_1000k/gcc        135MB/s ± 1%   111MB/s ± 1%  -17.65%  (p=0.008 n=5+5)
This commit is contained in:
Nigel Tao committed 2017-11-02 16:35:15 +11:00
1 parent ed6ce6fd54
commit 7d8085f891
8 files changed
+64 -17

No files matched your search

+15 -5
View File
@@ -96,6 +96,10 @@ typedef struct {
struct {
uint8_t* limit;
uint8_t* mark;
// use_limit is redundant, in that it always equals (limit != NULL), but
// having a separate bool can have a significant performance effect with
// gcc 4.8.4 (e.g. 1.1x on some benchmarks).
bool use_limit;
#ifdef PUFFS_USE_NO_OP_PERFORMANCE_HACKS
struct {
puffs_base__paired_nulls* noph0;
@@ -115,6 +119,10 @@ typedef struct {
struct {
uint8_t* limit;
uint8_t* mark;
// use_limit is redundant, in that it always equals (limit != NULL), but
// having a separate bool can have a significant performance effect with
// gcc 4.8.4 (e.g. 1.1x on some benchmarks).
// TODO: bool use_limit;
} private_impl;
} puffs_base__writer1;
@@ -647,6 +655,7 @@ static inline puffs_base__empty_struct puffs_base__reader1__limit(
o->private_impl.limit = ptr + limit;
}
}
o->private_impl.use_limit = true;
return ((puffs_base__empty_struct){});
}
@@ -672,6 +681,7 @@ static inline puffs_base__empty_struct puffs_base__writer1__limit(
o->private_impl.limit = ptr + limit;
}
}
// TODO: o->private_impl.use_limit = true;
return ((puffs_base__empty_struct){});
}
@@ -1155,7 +1165,7 @@ exit:
return status;
short_read_src:
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.limit) {
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.use_limit) {
status = PUFFS_FLATE__ERROR_UNEXPECTED_EOF;
goto exit;
}
@@ -1289,7 +1299,7 @@ exit:
return status;
short_read_src:
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.limit) {
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.use_limit) {
status = PUFFS_FLATE__ERROR_UNEXPECTED_EOF;
goto exit;
}
@@ -1682,7 +1692,7 @@ exit:
return status;
short_read_src:
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.limit) {
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.use_limit) {
status = PUFFS_FLATE__ERROR_UNEXPECTED_EOF;
goto exit;
}
@@ -1988,7 +1998,7 @@ exit:
return status;
short_read_src:
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.limit) {
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.use_limit) {
status = PUFFS_FLATE__ERROR_UNEXPECTED_EOF;
goto exit;
}
@@ -2480,7 +2490,7 @@ exit:
return status;
short_read_src:
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.limit) {
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.use_limit) {
status = PUFFS_FLATE__ERROR_UNEXPECTED_EOF;
goto exit;
}
+16 -6
View File
@@ -96,6 +96,10 @@ typedef struct {
struct {
uint8_t* limit;
uint8_t* mark;
// use_limit is redundant, in that it always equals (limit != NULL), but
// having a separate bool can have a significant performance effect with
// gcc 4.8.4 (e.g. 1.1x on some benchmarks).
bool use_limit;
#ifdef PUFFS_USE_NO_OP_PERFORMANCE_HACKS
struct {
puffs_base__paired_nulls* noph0;
@@ -115,6 +119,10 @@ typedef struct {
struct {
uint8_t* limit;
uint8_t* mark;
// use_limit is redundant, in that it always equals (limit != NULL), but
// having a separate bool can have a significant performance effect with
// gcc 4.8.4 (e.g. 1.1x on some benchmarks).
// TODO: bool use_limit;
} private_impl;
} puffs_base__writer1;
@@ -594,6 +602,7 @@ static inline puffs_base__empty_struct puffs_base__reader1__limit(
o->private_impl.limit = ptr + limit;
}
}
o->private_impl.use_limit = true;
return ((puffs_base__empty_struct){});
}
@@ -619,6 +628,7 @@ static inline puffs_base__empty_struct puffs_base__writer1__limit(
o->private_impl.limit = ptr + limit;
}
}
// TODO: o->private_impl.use_limit = true;
return ((puffs_base__empty_struct){});
}
@@ -880,7 +890,7 @@ exit:
return status;
short_read_src:
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.limit) {
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.use_limit) {
status = PUFFS_GIF__ERROR_UNEXPECTED_EOF;
goto exit;
}
@@ -954,7 +964,7 @@ exit:
return status;
short_read_src:
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.limit) {
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.use_limit) {
status = PUFFS_GIF__ERROR_UNEXPECTED_EOF;
goto exit;
}
@@ -1055,7 +1065,7 @@ exit:
return status;
short_read_src:
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.limit) {
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.use_limit) {
status = PUFFS_GIF__ERROR_UNEXPECTED_EOF;
goto exit;
}
@@ -1152,7 +1162,7 @@ exit:
return status;
short_read_src:
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.limit) {
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.use_limit) {
status = PUFFS_GIF__ERROR_UNEXPECTED_EOF;
goto exit;
}
@@ -1326,7 +1336,7 @@ exit:
return status;
short_read_src:
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.limit) {
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.use_limit) {
status = PUFFS_GIF__ERROR_UNEXPECTED_EOF;
goto exit;
}
@@ -1561,7 +1571,7 @@ exit:
return status;
short_read_src:
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.limit) {
if (a_src.buf && a_src.buf->closed && !a_src.private_impl.use_limit) {
status = PUFFS_GIF__ERROR_UNEXPECTED_EOF;
goto exit;
}
+8
View File
@@ -96,6 +96,10 @@ typedef struct {
struct {
uint8_t* limit;
uint8_t* mark;
// use_limit is redundant, in that it always equals (limit != NULL), but
// having a separate bool can have a significant performance effect with
// gcc 4.8.4 (e.g. 1.1x on some benchmarks).
bool use_limit;
#ifdef PUFFS_USE_NO_OP_PERFORMANCE_HACKS
struct {
puffs_base__paired_nulls* noph0;
@@ -115,6 +119,10 @@ typedef struct {
struct {
uint8_t* limit;
uint8_t* mark;
// use_limit is redundant, in that it always equals (limit != NULL), but
// having a separate bool can have a significant performance effect with
// gcc 4.8.4 (e.g. 1.1x on some benchmarks).
// TODO: bool use_limit;
} private_impl;
} puffs_base__writer1;
+8
View File
@@ -96,6 +96,10 @@ typedef struct {
struct {
uint8_t* limit;
uint8_t* mark;
// use_limit is redundant, in that it always equals (limit != NULL), but
// having a separate bool can have a significant performance effect with
// gcc 4.8.4 (e.g. 1.1x on some benchmarks).
bool use_limit;
#ifdef PUFFS_USE_NO_OP_PERFORMANCE_HACKS
struct {
puffs_base__paired_nulls* noph0;
@@ -115,6 +119,10 @@ typedef struct {
struct {
uint8_t* limit;
uint8_t* mark;
// use_limit is redundant, in that it always equals (limit != NULL), but
// having a separate bool can have a significant performance effect with
// gcc 4.8.4 (e.g. 1.1x on some benchmarks).
// TODO: bool use_limit;
} private_impl;
} puffs_base__writer1;