Update benchmarks and examples

This commit is contained in:
Leonardo committed 2019-10-29 12:00:46 -03:00
1 parent 33c33e8947
commit 415720c6a6
5 files changed
+34 -42

No files matched your search

+4 -4
View File
@@ -79,11 +79,11 @@ CMC_COLLECTION_GENERATE(MULTISET, ms, mset, /* K */, int)
{ \
printf("+------------------------------------------------------------ %10s\n", #NAME); \
printf("+------------------------------------------------------------ \n"); \
cmc_timer timer, total; \
struct cmc_timer timer, total; \
int r, k, v; \
size_t j; \
\
sname *coll = initfunc; \
struct sname *coll = initfunc; \
\
cmc_timer_start(total); \
cmc_timer_start(timer); \
@@ -118,7 +118,7 @@ CMC_COLLECTION_GENERATE(MULTISET, ms, mset, /* K */, int)
\
double search_time = timer.result; \
\
sname##_iter iter; \
struct sname##_iter iter; \
\
cmc_timer_start(timer); \
\
@@ -221,7 +221,7 @@ int main(void)
// Linear containers have to search for NMIN elements and non-linear (hash
// and tree) have to search for all elements.
cmc_timer timer;
struct cmc_timer timer;
cmc_timer_start(timer);
DEQUE_io_benchmark(array, sarray, NMIN);
-2
View File
@@ -6,5 +6,3 @@ main:
a.exe
gcc queue.c -I $(INCLUDE) $(CFLAGS) -o a.exe -DSAC_QUEUE
a.exe
gcc queue.c -I $(INCLUDE) $(CFLAGS) -o a.exe -DEXT_QUEUE
a.exe
+8 -14
View File
@@ -18,16 +18,12 @@
#if defined(CMC_QUEUE)
#include "cmc/queue.h"
QUEUE_GENERATE(q, queue, , int)
CMC_GENERATE_QUEUE(q, queue, int)
#define TARGET "QUEUE"
#elif defined(SAC_QUEUE)
#include "sac/queue.h"
SAC_QUEUE_GENERATE(q, queue, , int, MAX)
#define TARGET "SAC QUEUE"
#elif defined(EXT_QUEUE)
#include "ext/linkedqueue.h"
LINKEDQUEUE_GENERATE(q, queue, , int)
#define TARGET "LINKED QUEUE"
#else
#error Please define either CMC_QUEUE, SAC_QUEUE or EXT_QUEUE
#endif
@@ -36,19 +32,17 @@ int main(void)
{
#if defined(CMC_QUEUE)
queue *q = q_new(MAX);
struct queue *q = q_new(MAX);
#elif defined(SAC_QUEUE)
queue _q = q_new();
queue_ptr q = &_q;
#elif defined(EXT_QUEUE)
queue *q = q_new();
#endif
size_t sum = 0;
int i = 0;
timer_t timer;
TIMER_START(timer);
struct cmc_timer timer;
cmc_timer_start(timer);
while (q_count(q) != MAX)
{
@@ -65,8 +59,8 @@ int main(void)
}
TIMER_STOP(timer);
TIMER_CALC(timer);
cmc_timer_stop(timer);
cmc_timer_calc(timer);
printf("----------------------------------------\n");
printf("%s\n", TARGET);
@@ -74,8 +68,8 @@ int main(void)
printf("SUM: %" PRIuMAX "\n", sum);
printf("----------------------------------------\n");
#if defined(CMC_QUEUE) || defined(EXT_QUEUE)
q_free(q);
#if defined(CMC_QUEUE)
q_free(q, NULL);
#endif
return 0;