123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #include <time.h>
- #include "graph.h"
- #ifndef NT
- #define NT 1000000
- #endif
- static int test_graph_add_batch()
- {
- size_t nt = NT;
- LSUP_Triple *trp;
- CRITICAL(trp = malloc(nt * sizeof(LSUP_Triple)));
- for (size_t i = 0; i < nt; i++) {
-
- trp[i].s = LSUP_term_new(
- LSUP_TERM_URI, LSUP_term_gen_random_str(), NULL, NULL);
- trp[i].p = LSUP_term_new(
- LSUP_TERM_URI, LSUP_term_gen_random_str(), NULL, NULL);
- trp[i].o = LSUP_term_new(
- LSUP_TERM_URI, LSUP_term_gen_random_str(), NULL, NULL);
- }
- TRACE(STR, "Triples generated.");
- LSUP_Graph *gr = LSUP_graph_new(nt, NULL, LSUP_STORE_MEM);
- LSUP_graph_add(gr, trp, nt);
- TRACE(STR, "Graph populated.");
- LSUP_graph_free(gr);
- return 0;
- }
- int main()
- {
- int rc;
- clock_t start, end;
- double wallclock;
- start = clock();
- rc = test_graph_add_batch();
- end = clock();
- wallclock = (end - start) / CLOCKS_PER_SEC;
- printf("Time elapsed: %lf s\n", wallclock);
- return rc;
- }
|