MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / benchmark_node_creation_no_labels

Function benchmark_node_creation_no_labels

tests/unit/test_graph.c:108–143  ·  view source on GitHub ↗

Test graph creation time.

Source from the content-addressed store, hash-verified

106
107// Test graph creation time.
108void benchmark_node_creation_no_labels() {
109 printf("benchmark_node_creation_no_labels\n");
110 double tic[2];
111 int samples = 64;
112 double timings[samples];
113 int outliers = 0;
114 float threshold = 0.000006;
115 // size_t n = GRAPH_DEFAULT_NODE_CAP;
116 Node node;
117 size_t n = 1000000;
118 Graph *g = Graph_New(n, n);
119 Graph_AcquireWriteLock(g);
120
121 for(int i = 0; i < samples; i++) {
122 // Create N nodes, don't use labels.
123 simple_tic(tic);
124 for(int j = 0; j < n; j++) {
125 node = GE_NEW_NODE();
126 Graph_CreateNode(g, &node, NULL, 0);
127 }
128 timings[i] = simple_toc(tic);
129 printf("%zu Nodes created, time: %.6f sec\n", n, timings[i]);
130 if(timings[i] > threshold) outliers++;
131 }
132
133 if(outliers > samples * 0.1) {
134 printf("Node creation took too long\n");
135 for(int i = 0; i < samples; i++) {
136 printf("%zu Nodes created, time: %.6f sec\n", n, timings[i]);
137 }
138 // assert(false);
139 }
140
141 Graph_ReleaseLock(g);
142 Graph_Free(g);
143}
144
145void benchmark_edge_creation_with_relationships() {
146 printf("benchmark_edge_creation_with_relationships\n");

Callers 1

benchmark_graphFunction · 0.85

Calls 7

Graph_NewFunction · 0.85
Graph_AcquireWriteLockFunction · 0.85
simple_ticFunction · 0.85
Graph_CreateNodeFunction · 0.85
simple_tocFunction · 0.85
Graph_ReleaseLockFunction · 0.85
Graph_FreeFunction · 0.85

Tested by

no test coverage detected