diff options
author | Burt P <pburt0@gmail.com> | 2018-10-26 19:53:29 -0500 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2018-12-02 02:07:23 -0800 |
commit | a571f25a97a6158209405b14ff48248a309cc6a4 (patch) | |
tree | cc4809156b97db839964b9b35658017d513a0958 /modules/benchmark/zlib.c | |
parent | 23f2528e6aeedc532b4744be407c47f7010386d8 (diff) |
bench/zlib: minor fix, changes results significantly
(#298)
W: hardinfo uninitialized-variable /home/abuild/rpmbuild/BUILD/hardinfo-20181022T194523/modules/benchmark/zlib.c:28
This change significantly impacts the bench result.
All old results should be discarded, IMO.
I think I will also attempt to remake this benchmark
in a similar way to the blowfish benchmark. See PR #293.
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/benchmark/zlib.c')
-rw-r--r-- | modules/benchmark/zlib.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/modules/benchmark/zlib.c b/modules/benchmark/zlib.c index 2ded59a4..894d8e18 100644 --- a/modules/benchmark/zlib.c +++ b/modules/benchmark/zlib.c @@ -22,10 +22,17 @@ #include "benchmark.h" +/* must be less than or equal to + * file size of ( params.path_data + "benchmark.data" ) */ +#define BENCH_DATA_SIZE 65536 + +#define BENCH_EVENTS 50000 +#define BENCH_WTF_NUMBER 840205128 + static gpointer zlib_for(unsigned int start, unsigned int end, void *data, gint thread_number) { char *compressed; - uLong bound = compressBound(bound); + uLong bound = compressBound(BENCH_DATA_SIZE); unsigned int i; compressed = malloc(bound); @@ -33,11 +40,11 @@ static gpointer zlib_for(unsigned int start, unsigned int end, void *data, gint return NULL; for (i = start; i <= end; i++) { - char uncompressed[65536]; + char uncompressed[BENCH_DATA_SIZE]; uLong compressedBound = bound; uLong destBound = sizeof(uncompressed); - compress(compressed, &compressedBound, data, 65536); + compress(compressed, &compressedBound, data, BENCH_DATA_SIZE); uncompress(uncompressed, &destBound, compressed, compressedBound); } @@ -61,13 +68,13 @@ benchmark_zlib(void) shell_view_set_enabled(FALSE); shell_status_update("Running Zlib benchmark..."); - r = benchmark_parallel_for(0, 0, 50000, zlib_for, tmpsrc); + r = benchmark_parallel_for(0, 0, BENCH_EVENTS, zlib_for, tmpsrc); g_free(bdata_path); g_free(tmpsrc); - //TODO: explain in code comments - gdouble marks = (50000. * 65536.) / (r.elapsed_time * 840205128.); + //TODO: explain in code comments! + gdouble marks = ((double)BENCH_EVENTS * (double)BENCH_DATA_SIZE) / (r.elapsed_time * (double)BENCH_WTF_NUMBER); r.result = marks; bench_results[BENCHMARK_ZLIB] = r; } |