#include #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++) { //printf("i: %lu\n", 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; }