summaryrefslogtreecommitdiffhomepage
path: root/misc/benchmarks/plotbench
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-08 16:16:49 +0100
committerTyge Løvset <[email protected]>2023-02-08 17:18:24 +0100
commitc4441f5fc665194fbd7a894a67a64a08c3beac42 (patch)
tree82f231b6e8fcb75625166f98aa785baaa265a3d6 /misc/benchmarks/plotbench
parent673dd5319a488d4b702b94dd9aeda4e497ae4fbc (diff)
downloadSTC-modified-c4441f5fc665194fbd7a894a67a64a08c3beac42.tar.gz
STC-modified-c4441f5fc665194fbd7a894a67a64a08c3beac42.zip
Changed to use lowercase flow-control macros in examples (uppercase will still be supported). Improved many examples to use c_make() to init containers.
Diffstat (limited to 'misc/benchmarks/plotbench')
-rw-r--r--misc/benchmarks/plotbench/cdeq_benchmark.cpp38
-rw-r--r--misc/benchmarks/plotbench/clist_benchmark.cpp34
-rw-r--r--misc/benchmarks/plotbench/cmap_benchmark.cpp38
-rw-r--r--misc/benchmarks/plotbench/cpque_benchmark.cpp12
-rw-r--r--misc/benchmarks/plotbench/csmap_benchmark.cpp38
-rw-r--r--misc/benchmarks/plotbench/cvec_benchmark.cpp30
6 files changed, 95 insertions, 95 deletions
diff --git a/misc/benchmarks/plotbench/cdeq_benchmark.cpp b/misc/benchmarks/plotbench/cdeq_benchmark.cpp
index ed463ee4..1259cc07 100644
--- a/misc/benchmarks/plotbench/cdeq_benchmark.cpp
+++ b/misc/benchmarks/plotbench/cdeq_benchmark.cpp
@@ -29,29 +29,29 @@ Sample test_std_deque() {
s.test[INSERT].t1 = clock();
container con;
csrandom(seed);
- c_FORRANGE (N/3) con.push_front(crandom() & mask1);
- c_FORRANGE (N/3) {con.push_back(crandom() & mask1); con.pop_front();}
- c_FORRANGE (N/3) con.push_back(crandom() & mask1);
+ c_forrange (N/3) con.push_front(crandom() & mask1);
+ c_forrange (N/3) {con.push_back(crandom() & mask1); con.pop_front();}
+ c_forrange (N/3) con.push_back(crandom() & mask1);
s.test[INSERT].t2 = clock();
s.test[INSERT].sum = con.size();
s.test[ERASE].t1 = clock();
- c_FORRANGE (con.size()/2) { con.pop_front(); con.pop_back(); }
+ c_forrange (con.size()/2) { con.pop_front(); con.pop_back(); }
s.test[ERASE].t2 = clock();
s.test[ERASE].sum = con.size();
}{
container con;
csrandom(seed);
- c_FORRANGE (N) con.push_back(crandom() & mask2);
+ c_forrange (N) con.push_back(crandom() & mask2);
s.test[FIND].t1 = clock();
size_t sum = 0;
// Iteration - not inherent find - skipping
//container::iterator it;
- //c_FORRANGE (S) if ((it = std::find(con.begin(), con.end(), crandom() & mask2)) != con.end()) sum += *it;
+ //c_forrange (S) if ((it = std::find(con.begin(), con.end(), crandom() & mask2)) != con.end()) sum += *it;
s.test[FIND].t2 = clock();
s.test[FIND].sum = sum;
s.test[ITER].t1 = clock();
sum = 0;
- c_FORRANGE (R) c_FORRANGE (i, N) sum += con[i];
+ c_forrange (R) c_forrange (i, N) sum += con[i];
s.test[ITER].t2 = clock();
s.test[ITER].sum = sum;
s.test[DESTRUCT].t1 = clock();
@@ -73,29 +73,29 @@ Sample test_stc_deque() {
container con = cdeq_x_init();
//cdeq_x_reserve(&con, N);
csrandom(seed);
- c_FORRANGE (N/3) cdeq_x_push_front(&con, crandom() & mask1);
- c_FORRANGE (N/3) {cdeq_x_push_back(&con, crandom() & mask1); cdeq_x_pop_front(&con);}
- c_FORRANGE (N/3) cdeq_x_push_back(&con, crandom() & mask1);
+ c_forrange (N/3) cdeq_x_push_front(&con, crandom() & mask1);
+ c_forrange (N/3) {cdeq_x_push_back(&con, crandom() & mask1); cdeq_x_pop_front(&con);}
+ c_forrange (N/3) cdeq_x_push_back(&con, crandom() & mask1);
s.test[INSERT].t2 = clock();
s.test[INSERT].sum = cdeq_x_size(&con);
s.test[ERASE].t1 = clock();
- c_FORRANGE (cdeq_x_size(&con)/2) { cdeq_x_pop_front(&con); cdeq_x_pop_back(&con); }
+ c_forrange (cdeq_x_size(&con)/2) { cdeq_x_pop_front(&con); cdeq_x_pop_back(&con); }
s.test[ERASE].t2 = clock();
s.test[ERASE].sum = cdeq_x_size(&con);
cdeq_x_drop(&con);
}{
csrandom(seed);
container con = cdeq_x_init();
- c_FORRANGE (N) cdeq_x_push_back(&con, crandom() & mask2);
+ c_forrange (N) cdeq_x_push_back(&con, crandom() & mask2);
s.test[FIND].t1 = clock();
size_t sum = 0;
//cdeq_x_iter it, end = cdeq_x_end(&con);
- //c_FORRANGE (S) if ((it = cdeq_x_find(&con, crandom() & mask2)).ref != end.ref) sum += *it.ref;
+ //c_forrange (S) if ((it = cdeq_x_find(&con, crandom() & mask2)).ref != end.ref) sum += *it.ref;
s.test[FIND].t2 = clock();
s.test[FIND].sum = sum;
s.test[ITER].t1 = clock();
sum = 0;
- c_FORRANGE (R) c_FORRANGE (i, N) sum += con.data[i];
+ c_forrange (R) c_forrange (i, N) sum += con.data[i];
s.test[ITER].t2 = clock();
s.test[ITER].sum = sum;
s.test[DESTRUCT].t1 = clock();
@@ -109,10 +109,10 @@ Sample test_stc_deque() {
int main(int argc, char* argv[])
{
Sample std_s[SAMPLES + 1], stc_s[SAMPLES + 1];
- c_FORRANGE (i, SAMPLES) {
+ c_forrange (i, SAMPLES) {
std_s[i] = test_std_deque();
stc_s[i] = test_stc_deque();
- if (i > 0) c_FORRANGE (j, N_TESTS) {
+ if (i > 0) c_forrange (j, N_TESTS) {
if (secs(std_s[i].test[j]) < secs(std_s[0].test[j])) std_s[0].test[j] = std_s[i].test[j];
if (secs(stc_s[i].test[j]) < secs(stc_s[0].test[j])) stc_s[0].test[j] = stc_s[i].test[j];
if (stc_s[i].test[j].sum != stc_s[0].test[j].sum) printf("Error in sum: test %lld, sample %lld\n", i, j);
@@ -122,17 +122,17 @@ int main(int argc, char* argv[])
bool header = (argc > 2 && argv[2][0] == '1');
float std_sum = 0, stc_sum = 0;
- c_FORRANGE (j, N_TESTS) {
+ c_forrange (j, N_TESTS) {
std_sum += secs(std_s[0].test[j]);
stc_sum += secs(stc_s[0].test[j]);
}
if (header) printf("Compiler,Library,C,Method,Seconds,Ratio\n");
- c_FORRANGE (j, N_TESTS)
+ c_forrange (j, N_TESTS)
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, std_s[0].name, N, operations[j], secs(std_s[0].test[j]), 1.0f);
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, std_s[0].name, N, "total", std_sum, 1.0f);
- c_FORRANGE (j, N_TESTS)
+ c_forrange (j, N_TESTS)
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, operations[j], secs(stc_s[0].test[j]), secs(std_s[0].test[j]) ? secs(stc_s[0].test[j])/secs(std_s[0].test[j]) : 1.0f);
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, "total", stc_sum, stc_sum/std_sum);
}
diff --git a/misc/benchmarks/plotbench/clist_benchmark.cpp b/misc/benchmarks/plotbench/clist_benchmark.cpp
index aac61ebf..04c8e8cd 100644
--- a/misc/benchmarks/plotbench/clist_benchmark.cpp
+++ b/misc/benchmarks/plotbench/clist_benchmark.cpp
@@ -29,28 +29,28 @@ Sample test_std_forward_list() {
s.test[INSERT].t1 = clock();
container con;
csrandom(seed);
- c_FORRANGE (N/2) con.push_front(crandom() & mask1);
- c_FORRANGE (N/2) con.push_front(crandom() & mask1);
+ c_forrange (N/2) con.push_front(crandom() & mask1);
+ c_forrange (N/2) con.push_front(crandom() & mask1);
s.test[INSERT].t2 = clock();
s.test[INSERT].sum = 0;
s.test[ERASE].t1 = clock();
- c_FORRANGE (N) con.pop_front();
+ c_forrange (N) con.pop_front();
s.test[ERASE].t2 = clock();
s.test[ERASE].sum = 0;
}{
container con;
csrandom(seed);
- c_FORRANGE (N) con.push_front(crandom() & mask2);
+ c_forrange (N) con.push_front(crandom() & mask2);
s.test[FIND].t1 = clock();
size_t sum = 0;
container::iterator it;
// Iteration - not inherent find - skipping
- //c_FORRANGE (S) if ((it = std::find(con.begin(), con.end(), crandom() & mask2)) != con.end()) sum += *it;
+ //c_forrange (S) if ((it = std::find(con.begin(), con.end(), crandom() & mask2)) != con.end()) sum += *it;
s.test[FIND].t2 = clock();
s.test[FIND].sum = sum;
s.test[ITER].t1 = clock();
sum = 0;
- c_FORRANGE (R) for (auto i: con) sum += i;
+ c_forrange (R) for (auto i: con) sum += i;
s.test[ITER].t2 = clock();
s.test[ITER].sum = sum;
s.test[DESTRUCT].t1 = clock();
@@ -71,28 +71,28 @@ Sample test_stc_forward_list() {
s.test[INSERT].t1 = clock();
container con = clist_x_init();
csrandom(seed);
- c_FORRANGE (N/2) clist_x_push_front(&con, crandom() & mask1);
- c_FORRANGE (N/2) clist_x_push_back(&con, crandom() & mask1);
+ c_forrange (N/2) clist_x_push_front(&con, crandom() & mask1);
+ c_forrange (N/2) clist_x_push_back(&con, crandom() & mask1);
s.test[INSERT].t2 = clock();
s.test[INSERT].sum = 0;
s.test[ERASE].t1 = clock();
- c_FORRANGE (N) clist_x_pop_front(&con);
+ c_forrange (N) clist_x_pop_front(&con);
s.test[ERASE].t2 = clock();
s.test[ERASE].sum = 0;
clist_x_drop(&con);
}{
csrandom(seed);
container con = clist_x_init();
- c_FORRANGE (N) clist_x_push_front(&con, crandom() & mask2);
+ c_forrange (N) clist_x_push_front(&con, crandom() & mask2);
s.test[FIND].t1 = clock();
size_t sum = 0;
//clist_x_iter it, end = clist_x_end(&con);
- //c_FORRANGE (S) if ((it = clist_x_find(&con, crandom() & mask2)).ref != end.ref) sum += *it.ref;
+ //c_forrange (S) if ((it = clist_x_find(&con, crandom() & mask2)).ref != end.ref) sum += *it.ref;
s.test[FIND].t2 = clock();
s.test[FIND].sum = sum;
s.test[ITER].t1 = clock();
sum = 0;
- c_FORRANGE (R) c_FOREACH (i, clist_x, con) sum += *i.ref;
+ c_forrange (R) c_foreach (i, clist_x, con) sum += *i.ref;
s.test[ITER].t2 = clock();
s.test[ITER].sum = sum;
s.test[DESTRUCT].t1 = clock();
@@ -106,10 +106,10 @@ Sample test_stc_forward_list() {
int main(int argc, char* argv[])
{
Sample std_s[SAMPLES + 1], stc_s[SAMPLES + 1];
- c_FORRANGE (i, SAMPLES) {
+ c_forrange (i, SAMPLES) {
std_s[i] = test_std_forward_list();
stc_s[i] = test_stc_forward_list();
- if (i > 0) c_FORRANGE (j, N_TESTS) {
+ if (i > 0) c_forrange (j, N_TESTS) {
if (secs(std_s[i].test[j]) < secs(std_s[0].test[j])) std_s[0].test[j] = std_s[i].test[j];
if (secs(stc_s[i].test[j]) < secs(stc_s[0].test[j])) stc_s[0].test[j] = stc_s[i].test[j];
if (stc_s[i].test[j].sum != stc_s[0].test[j].sum) printf("Error in sum: test %lld, sample %lld\n", i, j);
@@ -119,17 +119,17 @@ int main(int argc, char* argv[])
bool header = (argc > 2 && argv[2][0] == '1');
float std_sum = 0, stc_sum = 0;
- c_FORRANGE (j, N_TESTS) {
+ c_forrange (j, N_TESTS) {
std_sum += secs(std_s[0].test[j]);
stc_sum += secs(stc_s[0].test[j]);
}
if (header) printf("Compiler,Library,C,Method,Seconds,Ratio\n");
- c_FORRANGE (j, N_TESTS)
+ c_forrange (j, N_TESTS)
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, std_s[0].name, N, operations[j], secs(std_s[0].test[j]), 1.0f);
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, std_s[0].name, N, "total", std_sum, 1.0f);
- c_FORRANGE (j, N_TESTS)
+ c_forrange (j, N_TESTS)
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, operations[j], secs(stc_s[0].test[j]), secs(std_s[0].test[j]) ? secs(stc_s[0].test[j])/secs(std_s[0].test[j]) : 1.0f);
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, "total", stc_sum, stc_sum/std_sum);
} \ No newline at end of file
diff --git a/misc/benchmarks/plotbench/cmap_benchmark.cpp b/misc/benchmarks/plotbench/cmap_benchmark.cpp
index 095b5513..7a8f29d2 100644
--- a/misc/benchmarks/plotbench/cmap_benchmark.cpp
+++ b/misc/benchmarks/plotbench/cmap_benchmark.cpp
@@ -29,30 +29,30 @@ Sample test_std_unordered_map() {
csrandom(seed);
s.test[INSERT].t1 = clock();
container con;
- c_FORRANGE (i, N/2) con.emplace(crandom() & mask1, i);
- c_FORRANGE (i, N/2) con.emplace(i, i);
+ c_forrange (i, N/2) con.emplace(crandom() & mask1, i);
+ c_forrange (i, N/2) con.emplace(i, i);
s.test[INSERT].t2 = clock();
s.test[INSERT].sum = con.size();
csrandom(seed);
s.test[ERASE].t1 = clock();
- c_FORRANGE (N) con.erase(crandom() & mask1);
+ c_forrange (N) con.erase(crandom() & mask1);
s.test[ERASE].t2 = clock();
s.test[ERASE].sum = con.size();
}{
container con;
csrandom(seed);
- c_FORRANGE (i, N/2) con.emplace(crandom() & mask1, i);
- c_FORRANGE (i, N/2) con.emplace(i, i);
+ c_forrange (i, N/2) con.emplace(crandom() & mask1, i);
+ c_forrange (i, N/2) con.emplace(i, i);
csrandom(seed);
s.test[FIND].t1 = clock();
size_t sum = 0;
container::iterator it;
- c_FORRANGE (N) if ((it = con.find(crandom() & mask1)) != con.end()) sum += it->second;
+ c_forrange (N) if ((it = con.find(crandom() & mask1)) != con.end()) sum += it->second;
s.test[FIND].t2 = clock();
s.test[FIND].sum = sum;
s.test[ITER].t1 = clock();
sum = 0;
- c_FORRANGE (R) for (auto i: con) sum += i.second;
+ c_forrange (R) for (auto i: con) sum += i.second;
s.test[ITER].t2 = clock();
s.test[ITER].sum = sum;
s.test[DESTRUCT].t1 = clock();
@@ -73,33 +73,33 @@ Sample test_stc_unordered_map() {
csrandom(seed);
s.test[INSERT].t1 = clock();
container con = cmap_x_init();
- c_FORRANGE (i, N/2) cmap_x_insert(&con, crandom() & mask1, i);
- c_FORRANGE (i, N/2) cmap_x_insert(&con, i, i);
+ c_forrange (i, N/2) cmap_x_insert(&con, crandom() & mask1, i);
+ c_forrange (i, N/2) cmap_x_insert(&con, i, i);
s.test[INSERT].t2 = clock();
s.test[INSERT].sum = cmap_x_size(&con);
csrandom(seed);
s.test[ERASE].t1 = clock();
- c_FORRANGE (N) cmap_x_erase(&con, crandom() & mask1);
+ c_forrange (N) cmap_x_erase(&con, crandom() & mask1);
s.test[ERASE].t2 = clock();
s.test[ERASE].sum = cmap_x_size(&con);
cmap_x_drop(&con);
}{
container con = cmap_x_init();
csrandom(seed);
- c_FORRANGE (i, N/2) cmap_x_insert(&con, crandom() & mask1, i);
- c_FORRANGE (i, N/2) cmap_x_insert(&con, i, i);
+ c_forrange (i, N/2) cmap_x_insert(&con, crandom() & mask1, i);
+ c_forrange (i, N/2) cmap_x_insert(&con, i, i);
csrandom(seed);
s.test[FIND].t1 = clock();
size_t sum = 0;
const cmap_x_value* val;
- c_FORRANGE (N)
+ c_forrange (N)
if ((val = cmap_x_get(&con, crandom() & mask1)))
sum += val->second;
s.test[FIND].t2 = clock();
s.test[FIND].sum = sum;
s.test[ITER].t1 = clock();
sum = 0;
- c_FORRANGE (R) c_FOREACH (i, cmap_x, con) sum += i.ref->second;
+ c_forrange (R) c_foreach (i, cmap_x, con) sum += i.ref->second;
s.test[ITER].t2 = clock();
s.test[ITER].sum = sum;
s.test[DESTRUCT].t1 = clock();
@@ -113,10 +113,10 @@ Sample test_stc_unordered_map() {
int main(int argc, char* argv[])
{
Sample std_s[SAMPLES + 1], stc_s[SAMPLES + 1];
- c_FORRANGE (i, SAMPLES) {
+ c_forrange (i, SAMPLES) {
std_s[i] = test_std_unordered_map();
stc_s[i] = test_stc_unordered_map();
- if (i > 0) c_FORRANGE (j, N_TESTS) {
+ if (i > 0) c_forrange (j, N_TESTS) {
if (secs(std_s[i].test[j]) < secs(std_s[0].test[j])) std_s[0].test[j] = std_s[i].test[j];
if (secs(stc_s[i].test[j]) < secs(stc_s[0].test[j])) stc_s[0].test[j] = stc_s[i].test[j];
if (stc_s[i].test[j].sum != stc_s[0].test[j].sum) printf("Error in sum: test %lld, sample %lld\n", i, j);
@@ -126,17 +126,17 @@ int main(int argc, char* argv[])
bool header = (argc > 2 && argv[2][0] == '1');
float std_sum = 0, stc_sum = 0;
- c_FORRANGE (j, N_TESTS) {
+ c_forrange (j, N_TESTS) {
std_sum += secs(std_s[0].test[j]);
stc_sum += secs(stc_s[0].test[j]);
}
if (header) printf("Compiler,Library,C,Method,Seconds,Ratio\n");
- c_FORRANGE (j, N_TESTS)
+ c_forrange (j, N_TESTS)
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, std_s[0].name, N, operations[j], secs(std_s[0].test[j]), 1.0f);
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, std_s[0].name, N, "total", std_sum, 1.0f);
- c_FORRANGE (j, N_TESTS)
+ c_forrange (j, N_TESTS)
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, operations[j], secs(stc_s[0].test[j]), secs(std_s[0].test[j]) ? secs(stc_s[0].test[j])/secs(std_s[0].test[j]) : 1.0f);
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, "total", stc_sum, stc_sum/std_sum);
} \ No newline at end of file
diff --git a/misc/benchmarks/plotbench/cpque_benchmark.cpp b/misc/benchmarks/plotbench/cpque_benchmark.cpp
index f2a85aee..a729c09f 100644
--- a/misc/benchmarks/plotbench/cpque_benchmark.cpp
+++ b/misc/benchmarks/plotbench/cpque_benchmark.cpp
@@ -20,14 +20,14 @@ void std_test()
std::priority_queue<float, std::vector<float>, std::greater<float>> pq;
rng = stc64_new(seed);
clock_t start = clock();
- c_FORRANGE (i, N)
+ c_forrange (i, N)
pq.push((float) stc64_randf(&rng)*100000);
printf("Built priority queue: %f secs\n", (clock() - start) / (float) CLOCKS_PER_SEC);
printf("%g ", pq.top());
start = clock();
- c_FORRANGE (i, N) {
+ c_forrange (i, N) {
pq.pop();
}
@@ -40,22 +40,22 @@ 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();
- c_FORRANGE (i, N)
+ c_forrange (i, N)
cpque_f_push(&pq, (float) stc64_randf(&rng)*100000);
printf("Built priority queue: %f secs\n", (clock() - start) / (float) CLOCKS_PER_SEC);
printf("%g ", *cpque_f_top(&pq));
- c_FORRANGE (i, M) {
+ c_forrange (i, M) {
cpque_f_pop(&pq);
}
start = clock();
- c_FORRANGE (i, M, N)
+ c_forrange (i, M, N)
cpque_f_pop(&pq);
printf("\npopped PQ: %f secs\n", (clock() - start) / (float) CLOCKS_PER_SEC);
}
diff --git a/misc/benchmarks/plotbench/csmap_benchmark.cpp b/misc/benchmarks/plotbench/csmap_benchmark.cpp
index 7dec8368..46bd695c 100644
--- a/misc/benchmarks/plotbench/csmap_benchmark.cpp
+++ b/misc/benchmarks/plotbench/csmap_benchmark.cpp
@@ -29,30 +29,30 @@ Sample test_std_map() {
csrandom(seed);
s.test[INSERT].t1 = clock();
container con;
- c_FORRANGE (i, N/2) con.emplace(crandom() & mask1, i);
- c_FORRANGE (i, N/2) con.emplace(i, i);
+ c_forrange (i, N/2) con.emplace(crandom() & mask1, i);
+ c_forrange (i, N/2) con.emplace(i, i);
s.test[INSERT].t2 = clock();
s.test[INSERT].sum = con.size();
csrandom(seed);
s.test[ERASE].t1 = clock();
- c_FORRANGE (N) con.erase(crandom() & mask1);
+ c_forrange (N) con.erase(crandom() & mask1);
s.test[ERASE].t2 = clock();
s.test[ERASE].sum = con.size();
}{
container con;
csrandom(seed);
- c_FORRANGE (i, N/2) con.emplace(crandom() & mask1, i);
- c_FORRANGE (i, N/2) con.emplace(i, i);
+ c_forrange (i, N/2) con.emplace(crandom() & mask1, i);
+ c_forrange (i, N/2) con.emplace(i, i);
csrandom(seed);
s.test[FIND].t1 = clock();
size_t sum = 0;
container::iterator it;
- c_FORRANGE (N) if ((it = con.find(crandom() & mask1)) != con.end()) sum += it->second;
+ c_forrange (N) if ((it = con.find(crandom() & mask1)) != con.end()) sum += it->second;
s.test[FIND].t2 = clock();
s.test[FIND].sum = sum;
s.test[ITER].t1 = clock();
sum = 0;
- c_FORRANGE (R) for (auto i: con) sum += i.second;
+ c_forrange (R) for (auto i: con) sum += i.second;
s.test[ITER].t2 = clock();
s.test[ITER].sum = sum;
s.test[DESTRUCT].t1 = clock();
@@ -74,33 +74,33 @@ Sample test_stc_map() {
csrandom(seed);
s.test[INSERT].t1 = clock();
container con = csmap_x_init();
- c_FORRANGE (i, N/2) csmap_x_insert(&con, crandom() & mask1, i);
- c_FORRANGE (i, N/2) csmap_x_insert(&con, i, i);
+ c_forrange (i, N/2) csmap_x_insert(&con, crandom() & mask1, i);
+ c_forrange (i, N/2) csmap_x_insert(&con, i, i);
s.test[INSERT].t2 = clock();
s.test[INSERT].sum = csmap_x_size(&con);
csrandom(seed);
s.test[ERASE].t1 = clock();
- c_FORRANGE (N) csmap_x_erase(&con, crandom() & mask1);
+ c_forrange (N) csmap_x_erase(&con, crandom() & mask1);
s.test[ERASE].t2 = clock();
s.test[ERASE].sum = csmap_x_size(&con);
csmap_x_drop(&con);
}{
container con = csmap_x_init();
csrandom(seed);
- c_FORRANGE (i, N/2) csmap_x_insert(&con, crandom() & mask1, i);
- c_FORRANGE (i, N/2) csmap_x_insert(&con, i, i);
+ c_forrange (i, N/2) csmap_x_insert(&con, crandom() & mask1, i);
+ c_forrange (i, N/2) csmap_x_insert(&con, i, i);
csrandom(seed);
s.test[FIND].t1 = clock();
size_t sum = 0;
const csmap_x_value* val;
- c_FORRANGE (N)
+ c_forrange (N)
if ((val = csmap_x_get(&con, crandom() & mask1)))
sum += val->second;
s.test[FIND].t2 = clock();
s.test[FIND].sum = sum;
s.test[ITER].t1 = clock();
sum = 0;
- c_FORRANGE (R) c_FOREACH (i, csmap_x, con) sum += i.ref->second;
+ c_forrange (R) c_foreach (i, csmap_x, con) sum += i.ref->second;
s.test[ITER].t2 = clock();
s.test[ITER].sum = sum;
s.test[DESTRUCT].t1 = clock();
@@ -114,10 +114,10 @@ Sample test_stc_map() {
int main(int argc, char* argv[])
{
Sample std_s[SAMPLES + 1], stc_s[SAMPLES + 1];
- c_FORRANGE (i, SAMPLES) {
+ c_forrange (i, SAMPLES) {
std_s[i] = test_std_map();
stc_s[i] = test_stc_map();
- if (i > 0) c_FORRANGE (j, N_TESTS) {
+ if (i > 0) c_forrange (j, N_TESTS) {
if (secs(std_s[i].test[j]) < secs(std_s[0].test[j])) std_s[0].test[j] = std_s[i].test[j];
if (secs(stc_s[i].test[j]) < secs(stc_s[0].test[j])) stc_s[0].test[j] = stc_s[i].test[j];
if (stc_s[i].test[j].sum != stc_s[0].test[j].sum) printf("Error in sum: test %lld, sample %lld\n", i, j);
@@ -127,17 +127,17 @@ int main(int argc, char* argv[])
bool header = (argc > 2 && argv[2][0] == '1');
float std_sum = 0, stc_sum = 0;
- c_FORRANGE (j, N_TESTS) {
+ c_forrange (j, N_TESTS) {
std_sum += secs(std_s[0].test[j]);
stc_sum += secs(stc_s[0].test[j]);
}
if (header) printf("Compiler,Library,C,Method,Seconds,Ratio\n");
- c_FORRANGE (j, N_TESTS)
+ c_forrange (j, N_TESTS)
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, std_s[0].name, N, operations[j], secs(std_s[0].test[j]), 1.0f);
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, std_s[0].name, N, "total", std_sum, 1.0f);
- c_FORRANGE (j, N_TESTS)
+ c_forrange (j, N_TESTS)
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, operations[j], secs(stc_s[0].test[j]), secs(std_s[0].test[j]) ? secs(stc_s[0].test[j])/secs(std_s[0].test[j]) : 1.0f);
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, "total", stc_sum, stc_sum/std_sum);
}
diff --git a/misc/benchmarks/plotbench/cvec_benchmark.cpp b/misc/benchmarks/plotbench/cvec_benchmark.cpp
index 466c7ff2..fe7e09fb 100644
--- a/misc/benchmarks/plotbench/cvec_benchmark.cpp
+++ b/misc/benchmarks/plotbench/cvec_benchmark.cpp
@@ -29,27 +29,27 @@ Sample test_std_vector() {
s.test[INSERT].t1 = clock();
container con;
csrandom(seed);
- c_FORRANGE (N) con.push_back(crandom() & mask1);
+ c_forrange (N) con.push_back(crandom() & mask1);
s.test[INSERT].t2 = clock();
s.test[INSERT].sum = con.size();
s.test[ERASE].t1 = clock();
- c_FORRANGE (N) con.pop_back();
+ c_forrange (N) con.pop_back();
s.test[ERASE].t2 = clock();
s.test[ERASE].sum = con.size();
}{
container con;
csrandom(seed);
- c_FORRANGE (N) con.push_back(crandom() & mask2);
+ c_forrange (N) con.push_back(crandom() & mask2);
s.test[FIND].t1 = clock();
size_t sum = 0;
//container::iterator it;
// Iteration - not inherent find - skipping
- //c_FORRANGE (S) if ((it = std::find(con.begin(), con.end(), crandom() & mask2)) != con.end()) sum += *it;
+ //c_forrange (S) if ((it = std::find(con.begin(), con.end(), crandom() & mask2)) != con.end()) sum += *it;
s.test[FIND].t2 = clock();
s.test[FIND].sum = sum;
s.test[ITER].t1 = clock();
sum = 0;
- c_FORRANGE (R) c_FORRANGE (i, N) sum += con[i];
+ c_forrange (R) c_forrange (i, N) sum += con[i];
s.test[ITER].t2 = clock();
s.test[ITER].sum = sum;
s.test[DESTRUCT].t1 = clock();
@@ -71,27 +71,27 @@ Sample test_stc_vector() {
s.test[INSERT].t1 = clock();
container con = cvec_x_init();
csrandom(seed);
- c_FORRANGE (N) cvec_x_push_back(&con, crandom() & mask1);
+ c_forrange (N) cvec_x_push_back(&con, crandom() & mask1);
s.test[INSERT].t2 = clock();
s.test[INSERT].sum = cvec_x_size(&con);
s.test[ERASE].t1 = clock();
- c_FORRANGE (N) { cvec_x_pop_back(&con); }
+ c_forrange (N) { cvec_x_pop_back(&con); }
s.test[ERASE].t2 = clock();
s.test[ERASE].sum = cvec_x_size(&con);
cvec_x_drop(&con);
}{
csrandom(seed);
container con = cvec_x_init();
- c_FORRANGE (N) cvec_x_push_back(&con, crandom() & mask2);
+ c_forrange (N) cvec_x_push_back(&con, crandom() & mask2);
s.test[FIND].t1 = clock();
size_t sum = 0;
//cvec_x_iter it, end = cvec_x_end(&con);
- //c_FORRANGE (S) if ((it = cvec_x_find(&con, crandom() & mask2)).ref != end.ref) sum += *it.ref;
+ //c_forrange (S) if ((it = cvec_x_find(&con, crandom() & mask2)).ref != end.ref) sum += *it.ref;
s.test[FIND].t2 = clock();
s.test[FIND].sum = sum;
s.test[ITER].t1 = clock();
sum = 0;
- c_FORRANGE (R) c_FORRANGE (i, N) sum += con.data[i];
+ c_forrange (R) c_forrange (i, N) sum += con.data[i];
s.test[ITER].t2 = clock();
s.test[ITER].sum = sum;
s.test[DESTRUCT].t1 = clock();
@@ -105,10 +105,10 @@ Sample test_stc_vector() {
int main(int argc, char* argv[])
{
Sample std_s[SAMPLES + 1] = {{NULL}}, stc_s[SAMPLES + 1] = {{NULL}};
- c_FORRANGE (i, SAMPLES) {
+ c_forrange (i, SAMPLES) {
std_s[i] = test_std_vector();
stc_s[i] = test_stc_vector();
- if (i > 0) c_FORRANGE (j, N_TESTS) {
+ if (i > 0) c_forrange (j, N_TESTS) {
if (secs(std_s[i].test[j]) < secs(std_s[0].test[j])) std_s[0].test[j] = std_s[i].test[j];
if (secs(stc_s[i].test[j]) < secs(stc_s[0].test[j])) stc_s[0].test[j] = stc_s[i].test[j];
if (stc_s[i].test[j].sum != stc_s[0].test[j].sum) printf("Error in sum: test %lld, sample %lld\n", i, j);
@@ -118,17 +118,17 @@ int main(int argc, char* argv[])
bool header = (argc > 2 && argv[2][0] == '1');
float std_sum = 0, stc_sum = 0;
- c_FORRANGE (j, N_TESTS) {
+ c_forrange (j, N_TESTS) {
std_sum += secs(std_s[0].test[j]);
stc_sum += secs(stc_s[0].test[j]);
}
if (header) printf("Compiler,Library,C,Method,Seconds,Ratio\n");
- c_FORRANGE (j, N_TESTS)
+ c_forrange (j, N_TESTS)
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, std_s[0].name, N, operations[j], secs(std_s[0].test[j]), 1.0f);
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, std_s[0].name, N, "total", std_sum, 1.0f);
- c_FORRANGE (j, N_TESTS)
+ c_forrange (j, N_TESTS)
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, operations[j], secs(stc_s[0].test[j]), secs(std_s[0].test[j]) ? secs(stc_s[0].test[j])/secs(std_s[0].test[j]) : 1.0f);
printf("%s,%s n:%d,%s,%.3f,%.3f\n", comp, stc_s[0].name, N, "total", stc_sum, stc_sum/std_sum);
}