From de629774cb912aa3d563f24d99258142713c3fcd Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Wed, 1 Jun 2022 16:28:07 +0200 Subject: Converted all files with DOS line endings to LINUX. --- benchmarks/plotbench/cpque_benchmark.cpp | 142 +++++++++++++++---------------- 1 file changed, 71 insertions(+), 71 deletions(-) (limited to 'benchmarks/plotbench/cpque_benchmark.cpp') diff --git a/benchmarks/plotbench/cpque_benchmark.cpp b/benchmarks/plotbench/cpque_benchmark.cpp index b38bed1a..afa9c07e 100644 --- a/benchmarks/plotbench/cpque_benchmark.cpp +++ b/benchmarks/plotbench/cpque_benchmark.cpp @@ -1,71 +1,71 @@ -#include -#include -#define i_static -#include - -#define i_val float -#define i_cmp -c_default_cmp -#define i_tag f -#include - -#include - -static const uint32_t seed = 1234; - -void std_test() -{ - stc64_t rng; - int N = 10000000, M = 10; - - std::priority_queue, std::greater> pq; - rng = stc64_new(seed); - clock_t start = clock(); - 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) { - pq.pop(); - } - - printf("\npopped PQ: %f secs\n\n", (clock() - start) / (float) CLOCKS_PER_SEC); -} - - -void stc_test() -{ - stc64_t rng; - int N = 10000000, M = 10; - - c_auto (cpque_f, pq) - { - rng = stc64_new(seed); - clock_t start = clock(); - 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, int, M) { - cpque_f_pop(&pq); - } - - start = clock(); - c_forrange (i, int, M, N) - cpque_f_pop(&pq); - printf("\npopped PQ: %f secs\n", (clock() - start) / (float) CLOCKS_PER_SEC); - } -} - - -int main() -{ - puts("STD P.QUEUE:"); - std_test(); - puts("\nSTC P.QUEUE:"); - stc_test(); -} +#include +#include +#define i_static +#include + +#define i_val float +#define i_cmp -c_default_cmp +#define i_tag f +#include + +#include + +static const uint32_t seed = 1234; + +void std_test() +{ + stc64_t rng; + int N = 10000000, M = 10; + + std::priority_queue, std::greater> pq; + rng = stc64_new(seed); + clock_t start = clock(); + 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) { + pq.pop(); + } + + printf("\npopped PQ: %f secs\n\n", (clock() - start) / (float) CLOCKS_PER_SEC); +} + + +void stc_test() +{ + stc64_t rng; + int N = 10000000, M = 10; + + c_auto (cpque_f, pq) + { + rng = stc64_new(seed); + clock_t start = clock(); + 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, int, M) { + cpque_f_pop(&pq); + } + + start = clock(); + c_forrange (i, int, M, N) + cpque_f_pop(&pq); + printf("\npopped PQ: %f secs\n", (clock() - start) / (float) CLOCKS_PER_SEC); + } +} + + +int main() +{ + puts("STD P.QUEUE:"); + std_test(); + puts("\nSTC P.QUEUE:"); + stc_test(); +} -- cgit v1.2.3