1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #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++) {
-
- LSUP_uri_new (NULL, trp[i].s);
- LSUP_uri_new (NULL, trp[i].p);
- LSUP_uri_new (NULL, trp[i].o);
- }
- TRACE(STR, "Triples generated.");
- LSUP_Graph *gr;
- LSUP_graph_new(LSUP_STORE_MEM, &gr);
- LSUP_graph_resize(gr, nt);
- LSUP_graph_add_trp(gr, trp, nt, NULL);
- 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;
- }
|