aboutsummaryrefslogtreecommitdiff
path: root/tests/zlib
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-25 17:26:58 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-25 17:26:58 -0800
commit64381b4b3cf017ea714e90e030161d83e170f758 (patch)
tree62045020ec2b46e11d5183d6ce26866bb35a18a6 /tests/zlib
parentf07fc69194d32dc5d8abd62c04e0f67f061a25ef (diff)
fix and enable zlib benchmark
Diffstat (limited to 'tests/zlib')
-rw-r--r--tests/zlib/benchmark.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/tests/zlib/benchmark.c b/tests/zlib/benchmark.c
index f8ab6205..9ad872e1 100644
--- a/tests/zlib/benchmark.c
+++ b/tests/zlib/benchmark.c
@@ -10,16 +10,16 @@ void __attribute__ ((noinline)) doit(char *buffer, int size, int i) {
static char *buffer2 = NULL;
static char *buffer3 = NULL;
- int maxCompressedSize = compressBound(size);
+ unsigned long maxCompressedSize = compressBound(size);
if (!buffer2) buffer2 = (char*)malloc(maxCompressedSize);
if (!buffer3) buffer3 = (char*)malloc(size);
- int compressedSize = maxCompressedSize;
+ unsigned long compressedSize = maxCompressedSize;
compress(buffer2, &compressedSize, buffer, size);
if (i == 0) printf("sizes: %d,%d\n", size, compressedSize);
- int decompressedSize = size;
+ unsigned long decompressedSize = size;
uncompress(buffer3, &decompressedSize, buffer2, compressedSize);
assert(decompressedSize == size);
if (i == 0) assert(strcmp(buffer, buffer3) == 0);
@@ -33,7 +33,6 @@ int main(int argc, char **argv) {
int i = 0;
int run = 0;
char runChar = 17;
- int sum = 0;
while (i < size) {
if (run > 0) {
run--;
@@ -46,11 +45,8 @@ int main(int argc, char **argv) {
}
}
buffer[i] = runChar;
- sum += buffer[i];
- if (argc == 100) printf("%d: %d\n", i, buffer[i]); // confuse llvm optimizer, work around possible bug, this is not speed-relevant anyhow
i++;
}
- printf("sum: %d\n", sum);
for (i = 0; i < iters; i++) {
doit(buffer, size, i);