diff options
| author | Tyge Løvset <[email protected]> | 2022-03-04 13:18:35 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-03-04 13:18:35 +0100 |
| commit | 3c379fbfb2b7301cd5c4f5371a9f0b96a1369b60 (patch) | |
| tree | 46975c8374107e44fd9605894ce5b02d981ba538 /benchmarks | |
| parent | c4301c6b492bb962a943335bf8df4920b2a699cf (diff) | |
| download | STC-modified-3c379fbfb2b7301cd5c4f5371a9f0b96a1369b60.tar.gz STC-modified-3c379fbfb2b7301cd5c4f5371a9f0b96a1369b60.zip | |
Updated printf formatting to portable code. This was also to use http://winlibs.com gcc+clang with ucrt runtime-libs without warnings.
Diffstat (limited to 'benchmarks')
| -rw-r--r-- | benchmarks/misc/rust_cmap.c | 10 | ||||
| -rw-r--r-- | benchmarks/misc/string_bench.c | 2 | ||||
| -rw-r--r-- | benchmarks/shootout_hashmaps.cpp | 14 |
3 files changed, 13 insertions, 13 deletions
diff --git a/benchmarks/misc/rust_cmap.c b/benchmarks/misc/rust_cmap.c index aa96c2c5..7df8fa59 100644 --- a/benchmarks/misc/rust_cmap.c +++ b/benchmarks/misc/rust_cmap.c @@ -30,7 +30,7 @@ int main() ms = CLOCKS_PER_SEC/1000;
cmap_u64_max_load_factor(&m, 0.8);
cmap_u64_reserve(&m, n);
- printf("STC cmap n = %zu, mask = 0x%zx\n", n, mask);
+ printf("STC cmap n = %" PRIuMAX ", mask = 0x%" PRIxMAX "\n", n, mask);
uint64_t rng[3] = {1872361123, 123879177, 87739234}, sum;
clock_t now = clock();
@@ -38,17 +38,17 @@ int main() uint64_t key = romu_trio(rng) & mask;
cmap_u64_insert(&m, key, 0).ref->second += 1;
}
- printf("insert : %zums \tsize : %zu\n", (clock() - now)/ms, cmap_u64_size(m));
+ printf("insert : %zums \tsize : %" PRIuMAX "\n", (clock() - now)/ms, cmap_u64_size(m));
now = clock();
sum = 0;
c_forrange (key, mask + 1) { sum += cmap_u64_contains(&m, key); }
- printf("lookup : %zums \tsum : %zu\n", (clock() - now)/ms, sum);
+ printf("lookup : %zums \tsum : %" PRIuMAX "\n", (clock() - now)/ms, sum);
now = clock();
sum = 0;
c_foreach (i, cmap_u64, m) { sum += i.ref->second; }
- printf("iterate : %zums \tsum : %zu\n", (clock() - now)/ms, sum);
+ printf("iterate : %zums \tsum : %" PRIuMAX "\n", (clock() - now)/ms, sum);
uint64_t rng2[3] = {1872361123, 123879177, 87739234};
now = clock();
@@ -56,7 +56,7 @@ int main() uint64_t key = romu_trio(rng2) & mask;
cmap_u64_erase(&m, key);
}
- printf("remove : %zums \tsize : %zu\n", (clock() - now)/ms, cmap_u64_size(m));
+ printf("remove : %zums \tsize : %" PRIuMAX "\n", (clock() - now)/ms, cmap_u64_size(m));
printf("press a key:\n"); getchar();
}
}
\ No newline at end of file diff --git a/benchmarks/misc/string_bench.c b/benchmarks/misc/string_bench.c index e93328d4..fb2a70b2 100644 --- a/benchmarks/misc/string_bench.c +++ b/benchmarks/misc/string_bench.c @@ -149,5 +149,5 @@ void benchmark(cvec_str vec_string, struct Maps maps) grandtotal += total;
printf(" timing:%5.0fms\n", (clock() - stopwatch) / (float)CLOCKS_PER_SEC * 1000.0f);
- printf("C grandtotal: %zu <--- Ignore this\n", grandtotal);
+ printf("C grandtotal: %" PRIuMAX " <--- Ignore this\n", grandtotal);
}
diff --git a/benchmarks/shootout_hashmaps.cpp b/benchmarks/shootout_hashmaps.cpp index 6c8c1f00..cd336931 100644 --- a/benchmarks/shootout_hashmaps.cpp +++ b/benchmarks/shootout_hashmaps.cpp @@ -145,7 +145,7 @@ size_t seed; sum += ++ M##_EMPLACE(X, RAND(keybits), i); \ } \ difference = clock() - before; \ - printf(#M ": time: %5.02f, size: %zu, buckets: %8zu, sum: %zu\n", \ + printf(#M ": time: %5.02f, size: %" PRIuMAX ", buckets: %8zu, sum: %" PRIuMAX "\n", \ (float) difference / CLOCKS_PER_SEC, (size_t) M##_SIZE(X), (size_t) M##_BUCKETS(X), sum); \ M##_DTOR(X); \ } @@ -161,7 +161,7 @@ size_t seed; erased += M##_ERASE(X, RAND(keybits)); \ } \ difference = clock() - before; \ - printf(#M ": time: %5.02f, size: %zu, buckets: %8zu, erased %zu, sum: %zu\n", \ + printf(#M ": time: %5.02f, size: %" PRIuMAX ", buckets: %8zu, erased %" PRIuMAX ", sum: %" PRIuMAX "\n", \ (float) difference / CLOCKS_PER_SEC, (size_t) M##_SIZE(X), (size_t) M##_BUCKETS(X), erased, sum); \ M##_DTOR(X); \ } @@ -176,7 +176,7 @@ size_t seed; for (size_t i = 0; i < n; ++i) \ erased += M##_ERASE(X, i); \ difference = clock() - before; \ - printf(#M ": time: %5.02f, size: %zu, buckets: %8zu, erased %zu\n", \ + printf(#M ": time: %5.02f, size: %" PRIuMAX ", buckets: %8zu, erased %" PRIuMAX "\n", \ (float) difference / CLOCKS_PER_SEC, (size_t) M##_SIZE(X), (size_t) M##_BUCKETS(X), erased); \ M##_DTOR(X); \ } @@ -194,7 +194,7 @@ size_t seed; for (size_t i = 0; i < n; ++i) \ erased += M##_ERASE(X, RAND(keybits)); \ difference = clock() - before; \ - printf(#M ": time: %5.02f, size: %zu, buckets: %8zu, erased %zu\n", \ + printf(#M ": time: %5.02f, size: %" PRIuMAX ", buckets: %8zu, erased %" PRIuMAX "\n", \ (float) difference / CLOCKS_PER_SEC, (size_t) M##_SIZE(X), (size_t) M##_BUCKETS(X), erased); \ M##_DTOR(X); \ } @@ -212,7 +212,7 @@ size_t seed; for (size_t k=0; k < x; k++) M##_FOR (X, it) \ sum += M##_ITEM(X, it); \ difference = clock() - before; \ - printf(#M ": time: %5.02f, size: %zu, buckets: %8zu, repeats: %zu, sum: %zu\n", \ + printf(#M ": time: %5.02f, size: %" PRIuMAX ", buckets: %8zu, repeats: %" PRIuMAX ", sum: %" PRIuMAX "\n", \ (float) difference / CLOCKS_PER_SEC, (size_t) M##_SIZE(X), (size_t) M##_BUCKETS(X), x, sum); \ M##_DTOR(X); \ } @@ -234,7 +234,7 @@ size_t seed; for (size_t i = 0; i < x; ++i) \ found += M##_FIND(X, RAND(keybits)); \ difference = clock() - before; \ - printf(#M ": time: %5.02f, size: %zu, buckets: %8zu, lookups: %zu, found: %zu\n", \ + printf(#M ": time: %5.02f, size: %" PRIuMAX ", buckets: %8zu, lookups: %" PRIuMAX ", found: %" PRIuMAX "\n", \ (float) difference / CLOCKS_PER_SEC, (size_t) M##_SIZE(X), (size_t) M##_BUCKETS(X), x*2, found); \ M##_DTOR(X); \ } @@ -273,7 +273,7 @@ int main(int argc, char* argv[]) "UMAP = std::unordered_map\n\n"); printf("Usage %s [n-million=%d key-bits=%d]\n", argv[0], DEFAULT_N_MILL, DEFAULT_KEYBITS); - printf("N-base = %d. Random keys are in range [0, 2^%d). Seed = %zu:\n", n_mill, keybits, seed); + printf("N-base = %d. Random keys are in range [0, 2^%d). Seed = %" PRIuMAX ":\n", n_mill, keybits, seed); printf("\nT0: Insert/update random keys:\n"); RUN_TEST(0) |
