summaryrefslogtreecommitdiffhomepage
path: root/benchmarks
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-10-14 16:02:25 +0200
committerTyge Løvset <[email protected]>2022-10-14 16:02:25 +0200
commitd26fd02b70b9f091c2bcfa350e420f74c1f023f8 (patch)
tree7ca2902ee839cb1ce7bfc3333f6ead2e4ea39ef2 /benchmarks
parent54c08dc031c622e78dc134353690ed359b9173d8 (diff)
downloadSTC-modified-d26fd02b70b9f091c2bcfa350e420f74c1f023f8.tar.gz
STC-modified-d26fd02b70b9f091c2bcfa350e420f74c1f023f8.zip
Replaced PRIuMAX with new c_zu macro in examples. "%zu" is not supported by mingw64 and PRIuMAX is not a replacement for "zu".
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/misc/rust_cmap.c10
-rw-r--r--benchmarks/shootout_hashmaps.cpp12
2 files changed, 11 insertions, 11 deletions
diff --git a/benchmarks/misc/rust_cmap.c b/benchmarks/misc/rust_cmap.c
index e5d85b1c..20ed87be 100644
--- a/benchmarks/misc/rust_cmap.c
+++ b/benchmarks/misc/rust_cmap.c
@@ -29,7 +29,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 = %" PRIuMAX ", mask = 0x%" PRIxMAX "\n", n, mask);
+ printf("STC cmap n = %" c_zu ", mask = 0x%" PRIxMAX "\n", n, mask);
uint64_t rng[3] = {1872361123, 123879177, 87739234}, sum;
clock_t now = clock();
@@ -37,17 +37,17 @@ int main()
uint64_t key = romu_trio(rng) & mask;
cmap_u64_insert(&m, key, 0).ref->second += 1;
}
- printf("insert : %" PRIuMAX "ms \tsize : %" PRIuMAX "\n", (clock() - now)/ms, cmap_u64_size(&m));
+ printf("insert : %" c_zu "ms \tsize : %" c_zu "\n", (clock() - now)/ms, cmap_u64_size(&m));
now = clock();
sum = 0;
c_forloop (key, mask + 1) { sum += cmap_u64_contains(&m, key); }
- printf("lookup : %" PRIuMAX "ms \tsum : %" PRIuMAX "\n", (clock() - now)/ms, sum);
+ printf("lookup : %" c_zu "ms \tsum : %" c_zu "\n", (clock() - now)/ms, sum);
now = clock();
sum = 0;
c_foreach (i, cmap_u64, m) { sum += i.ref->second; }
- printf("iterate : %" PRIuMAX "ms \tsum : %" PRIuMAX "\n", (clock() - now)/ms, sum);
+ printf("iterate : %" c_zu "ms \tsum : %" c_zu "\n", (clock() - now)/ms, sum);
uint64_t rng2[3] = {1872361123, 123879177, 87739234};
now = clock();
@@ -55,7 +55,7 @@ int main()
uint64_t key = romu_trio(rng2) & mask;
cmap_u64_erase(&m, key);
}
- printf("remove : %" PRIuMAX "ms \tsize : %" PRIuMAX "\n", (clock() - now)/ms, cmap_u64_size(&m));
+ printf("remove : %" c_zu "ms \tsize : %" c_zu "\n", (clock() - now)/ms, cmap_u64_size(&m));
printf("press a key:\n"); getchar();
}
}
diff --git a/benchmarks/shootout_hashmaps.cpp b/benchmarks/shootout_hashmaps.cpp
index 334eff64..cc1778d1 100644
--- a/benchmarks/shootout_hashmaps.cpp
+++ b/benchmarks/shootout_hashmaps.cpp
@@ -184,7 +184,7 @@ KHASH_MAP_INIT_INT64(ii, IValue)
sum += ++ M##_PUT(X, RAND(keybits), i); \
} \
difference = clock() - before; \
- printf(#M ": time: %5.03f, size: %" PRIuMAX ", buckets: %8" PRIuMAX ", sum: %" PRIuMAX "\n", \
+ printf(#M ": time: %5.03f, size: %" c_zu ", buckets: %8" c_zu ", sum: %" c_zu "\n", \
(float) difference / CLOCKS_PER_SEC, (size_t) M##_SIZE(X), (size_t) M##_BUCKETS(X), sum); \
M##_DTOR(X); \
}
@@ -199,7 +199,7 @@ KHASH_MAP_INIT_INT64(ii, IValue)
for (size_t i = 0; i < n; ++i) \
erased += M##_ERASE(X, i); \
difference = clock() - before; \
- printf(#M ": time: %5.03f, size: %" PRIuMAX ", buckets: %8" PRIuMAX ", erased %" PRIuMAX "\n", \
+ printf(#M ": time: %5.03f, size: %" c_zu ", buckets: %8" c_zu ", erased %" c_zu "\n", \
(float) difference / CLOCKS_PER_SEC, (size_t) M##_SIZE(X), (size_t) M##_BUCKETS(X), erased); \
M##_DTOR(X); \
}
@@ -217,7 +217,7 @@ KHASH_MAP_INIT_INT64(ii, IValue)
for (size_t i = 0; i < n; ++i) \
erased += M##_ERASE(X, RAND(keybits)); \
difference = clock() - before; \
- printf(#M ": time: %5.03f, size: %" PRIuMAX ", buckets: %8" PRIuMAX ", erased %" PRIuMAX "\n", \
+ printf(#M ": time: %5.03f, size: %" c_zu ", buckets: %8" c_zu ", erased %" c_zu "\n", \
(float) difference / CLOCKS_PER_SEC, (size_t) M##_SIZE(X), (size_t) M##_BUCKETS(X), erased); \
M##_DTOR(X); \
}
@@ -235,7 +235,7 @@ KHASH_MAP_INIT_INT64(ii, IValue)
for (size_t k=0; k < rep; k++) M##_FOR (X, it) \
sum += M##_ITEM(X, it); \
difference = clock() - before; \
- printf(#M ": time: %5.03f, size: %" PRIuMAX ", buckets: %8" PRIuMAX ", repeats: %" PRIuMAX ", sum: %" PRIuMAX "\n", \
+ printf(#M ": time: %5.03f, size: %" c_zu ", buckets: %8" c_zu ", repeats: %" c_zu ", sum: %" c_zu "\n", \
(float) difference / CLOCKS_PER_SEC, (size_t) M##_SIZE(X), (size_t) M##_BUCKETS(X), rep, sum); \
M##_DTOR(X); \
}
@@ -257,7 +257,7 @@ KHASH_MAP_INIT_INT64(ii, IValue)
for (size_t i = 0; i < x; ++i) \
found += M##_FIND(X, RAND(keybits)); \
difference = clock() - before; \
- printf(#M ": time: %5.03f, size: %" PRIuMAX ", buckets: %8" PRIuMAX ", lookups: %" PRIuMAX ", found: %" PRIuMAX "\n", \
+ printf(#M ": time: %5.03f, size: %" c_zu ", buckets: %8" c_zu ", lookups: %" c_zu ", found: %" c_zu "\n", \
(float) difference / CLOCKS_PER_SEC, (size_t) M##_SIZE(X), (size_t) M##_BUCKETS(X), x*2, found); \
M##_DTOR(X); \
}
@@ -299,7 +299,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 = %" PRIuMAX ":\n", n_mill, keybits, seed);
+ printf("N-base = %d. Random keys are in range [0, 2^%d). Seed = %" c_zu ":\n", n_mill, keybits, seed);
printf("\nT1: Insert/update random keys:\n");
RUN_TEST(1)