summaryrefslogtreecommitdiffhomepage
path: root/misc/benchmarks
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-12-23 23:55:10 +0100
committerTyge Løvset <[email protected]>2022-12-23 23:55:10 +0100
commitd623c6c85071b9af5d607bb5d9aceceaea05220a (patch)
treef20fc3714f86e1553d1103bed6dc8efefcbd9d6b /misc/benchmarks
parent5f57d597cd27aef55adbcb3b452973b0c6e33667 (diff)
downloadSTC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.tar.gz
STC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.zip
Experimental uppercase macros.
Diffstat (limited to 'misc/benchmarks')
-rw-r--r--misc/benchmarks/misc/rust_cmap.c10
-rw-r--r--misc/benchmarks/misc/string_bench_STC.cpp16
-rw-r--r--misc/benchmarks/misc/string_bench_STD.cpp4
-rw-r--r--misc/benchmarks/plotbench/cpque_benchmark.cpp2
4 files changed, 16 insertions, 16 deletions
diff --git a/misc/benchmarks/misc/rust_cmap.c b/misc/benchmarks/misc/rust_cmap.c
index 83b7dd19..18635c35 100644
--- a/misc/benchmarks/misc/rust_cmap.c
+++ b/misc/benchmarks/misc/rust_cmap.c
@@ -24,7 +24,7 @@ uint64_t romu_trio(uint64_t s[3]) {
int main()
{
- c_auto (cmap_u64, m) {
+ c_AUTO (cmap_u64, m) {
const size_t n = 50000000,
mask = (1 << 25) - 1,
ms = CLOCKS_PER_SEC/1000;
@@ -33,7 +33,7 @@ int main()
uint64_t rng[3] = {1872361123, 123879177, 87739234}, sum;
clock_t now = clock();
- c_forrange (n) {
+ c_FORRANGE (n) {
uint64_t key = romu_trio(rng) & mask;
cmap_u64_insert(&m, key, 0).ref->second += 1;
}
@@ -41,17 +41,17 @@ int main()
now = clock();
sum = 0;
- c_forrange (key, mask + 1) { sum += cmap_u64_contains(&m, key); }
+ c_FORRANGE (key, mask + 1) { sum += cmap_u64_contains(&m, key); }
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; }
+ c_FOREACH (i, cmap_u64, m) { sum += i.ref->second; }
printf("iterate : %" c_ZU "ms \tsum : %" c_ZU "\n", (clock() - now)/ms, sum);
uint64_t rng2[3] = {1872361123, 123879177, 87739234};
now = clock();
- c_forrange (n) {
+ c_FORRANGE (n) {
uint64_t key = romu_trio(rng2) & mask;
cmap_u64_erase(&m, key);
}
diff --git a/misc/benchmarks/misc/string_bench_STC.cpp b/misc/benchmarks/misc/string_bench_STC.cpp
index ae8e4c38..39a46d50 100644
--- a/misc/benchmarks/misc/string_bench_STC.cpp
+++ b/misc/benchmarks/misc/string_bench_STC.cpp
@@ -37,8 +37,8 @@
cvec_str read_file(const char* name)
{
cvec_str data = cvec_str_init();
- c_auto (cstr, line)
- c_with (FILE* f = fopen(name, "r"), fclose(f))
+ c_AUTO (cstr, line)
+ c_WITH (FILE* f = fopen(name, "r"), fclose(f))
while (cstr_getline(&line, f))
cvec_str_emplace_back(&data, cstr_str(&line));
return data;
@@ -185,12 +185,12 @@ const size_t MAX_LOOP = 2000;
int main()
{
- c_auto (cvec_str, vec_string)
- c_auto (cvec_sv, vec_stringview)
- c_auto (csmap_str, mapTrans)
- c_auto (csmap_ssv, mapSview)
- c_auto (cmap_str, unordmapTrans)
- c_auto (cmap_ssv, unordmapSview)
+ c_AUTO (cvec_str, vec_string)
+ c_AUTO (cvec_sv, vec_stringview)
+ c_AUTO (csmap_str, mapTrans)
+ c_AUTO (csmap_ssv, mapSview)
+ c_AUTO (cmap_str, unordmapTrans)
+ c_AUTO (cmap_ssv, unordmapSview)
{
std::cout << "Short String Benchmark" << std::endl;
std::cout << "======================" << std::endl;
diff --git a/misc/benchmarks/misc/string_bench_STD.cpp b/misc/benchmarks/misc/string_bench_STD.cpp
index 8bb87937..68065923 100644
--- a/misc/benchmarks/misc/string_bench_STD.cpp
+++ b/misc/benchmarks/misc/string_bench_STD.cpp
@@ -16,8 +16,8 @@
std::vector<std::string> read_file(const char* name)
{
std::vector<std::string> data;
- c_auto (cstr, line)
- c_with (FILE* f = fopen(name, "r"), fclose(f))
+ c_AUTO (cstr, line)
+ c_WITH (FILE* f = fopen(name, "r"), fclose(f))
while (cstr_getline(&line, f))
data.emplace_back(cstr_str(&line));
return data;
diff --git a/misc/benchmarks/plotbench/cpque_benchmark.cpp b/misc/benchmarks/plotbench/cpque_benchmark.cpp
index a729c09f..d6c2eda4 100644
--- a/misc/benchmarks/plotbench/cpque_benchmark.cpp
+++ b/misc/benchmarks/plotbench/cpque_benchmark.cpp
@@ -40,7 +40,7 @@ void stc_test()
stc64_t rng;
int N = 10000000, M = 10;
- c_auto (cpque_f, pq)
+ c_AUTO (cpque_f, pq)
{
rng = stc64_new(seed);
clock_t start = clock();