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

Function benchmark_node_creation_with_labels

tests/unit/test_graph.c:60–105  ·  view source on GitHub ↗

TODO benchmark functions are currently not invoked */

Source from the content-addressed store, hash-verified

58
59/* TODO benchmark functions are currently not invoked */
60void benchmark_node_creation_with_labels() {
61 printf("benchmark_node_creation_with_labels\n");
62 double tic[2];
63 int samples = 64;
64 int label_count = 3;
65 double timings[samples];
66 int outliers = 0;
67 float threshold = 0.0018;
68 // size_t n = GRAPH_DEFAULT_NODE_CAP;
69 size_t n = 1000000;
70 Graph *g = Graph_New(n, n);
71 Graph_AcquireWriteLock(g);
72
73 // Introduce labels and relations to graph.
74 for(int i = 0; i < label_count; i++) {
75 Graph_AddRelationType(g); // Typed relation.
76 Graph_AddLabel(g); // Typed node.
77 }
78
79 Node node;
80
81 // Create N nodes with labels.
82 for(int i = 0; i < samples; i++) {
83 simple_tic(tic);
84 for(unsigned int j = 0; j < n; j++) {
85 node = GE_NEW_NODE();
86 Graph_CreateNode(g, &node, NULL, 0);
87 }
88 timings[i] = simple_toc(tic);
89
90 printf("%zu Nodes created, time: %.6f sec\n", n, timings[i]);
91 if(timings[i] > threshold)
92 outliers++;
93 }
94
95 if(outliers > samples * 0.1) {
96 printf("Node creation took too long\n");
97 for(int i = 0; i < samples; i++) {
98 printf("%zu Nodes created, time: %.6f sec\n", n, timings[i]);
99 }
100 // assert(false);
101 }
102
103 Graph_ReleaseLock(g);
104 Graph_Free(g);
105}
106
107// Test graph creation time.
108void benchmark_node_creation_no_labels() {

Callers 1

benchmark_graphFunction · 0.85

Calls 9

Graph_NewFunction · 0.85
Graph_AcquireWriteLockFunction · 0.85
Graph_AddRelationTypeFunction · 0.85
Graph_AddLabelFunction · 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