summaryrefslogtreecommitdiffhomepage
path: root/benchmarks/plotbench/cpque_benchmark.cpp
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-12-19 12:21:44 +0100
committerTyge Løvset <[email protected]>2021-12-19 12:21:44 +0100
commit92b950333c6c7002bdbf1b60af44a249dc0cef9c (patch)
tree4b1acfcdba0bd940f829c53910587e27b5e0af90 /benchmarks/plotbench/cpque_benchmark.cpp
parent183a89859ba9914ee0546e4482b40be199e52292 (diff)
downloadSTC-modified-92b950333c6c7002bdbf1b60af44a249dc0cef9c.tar.gz
STC-modified-92b950333c6c7002bdbf1b60af44a249dc0cef9c.zip
First commit for Version 3 of STC. Main changes are consistent rename of '_del' to '_drop' and '_compare' to '_cmp'.
Also i_key_ref (earlier i_key_sptr) and i_val_ref replaced by more general i_key_bind/i_val_bind.
Diffstat (limited to 'benchmarks/plotbench/cpque_benchmark.cpp')
-rw-r--r--benchmarks/plotbench/cpque_benchmark.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/benchmarks/plotbench/cpque_benchmark.cpp b/benchmarks/plotbench/cpque_benchmark.cpp
index 19a9c701..33e55719 100644
--- a/benchmarks/plotbench/cpque_benchmark.cpp
+++ b/benchmarks/plotbench/cpque_benchmark.cpp
@@ -3,7 +3,7 @@
#include <stc/crandom.h>
#define i_val float
-#define i_cmp -c_default_compare
+#define i_cmp -c_default_cmp
#define i_tag f
#include <stc/cpque.h>
@@ -14,11 +14,12 @@ int main()
int N = 10000000, M = 10;
cpque_f pq = cpque_f_init();
+ cpque_f_resize(&pq, N, 0.0f);
rng = stc64_init(seed);
clock_t start = clock();
- c_forrange (i, int, N)
- cpque_f_push_back(&pq, (float) stc64_randf(&rng)*100000);
+ c_forrange (i, N)
+ pq.data[i] = (float) stc64_randf(&rng)*100000;
cpque_f_make_heap(&pq);
printf("Built priority queue: %f secs\n", (clock() - start) / (float) CLOCKS_PER_SEC);
@@ -44,5 +45,5 @@ int main()
}
puts("");
- cpque_f_del(&pq);
+ cpque_f_drop(&pq);
}