summaryrefslogtreecommitdiffhomepage
path: root/benchmarks/plotbench/cpque_benchmark.cpp
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-12-29 15:14:37 +0100
committerGitHub <[email protected]>2021-12-29 15:14:37 +0100
commita53b2f4269951e0b5340723670137b4fdf96534c (patch)
treee5d36c28d0fd548873216426bb00a6b59d2730dd /benchmarks/plotbench/cpque_benchmark.cpp
parent183a89859ba9914ee0546e4482b40be199e52292 (diff)
parent92f5421493932d00e63b33152331a36cc4fc9491 (diff)
downloadSTC-modified-a53b2f4269951e0b5340723670137b4fdf96534c.tar.gz
STC-modified-a53b2f4269951e0b5340723670137b4fdf96534c.zip
Merge pull request #17 from tylov/version3
Version3 Breaking changes are covered by the migration guide in the NEWS section in README.md
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);
}