Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit f5e54b8

Browse files
committed
Modified benchmarks
1 parent ede5d61 commit f5e54b8

1 file changed

Lines changed: 2 additions & 79 deletions

File tree

src/benchmark/Neo4jBenchmark.java

Lines changed: 2 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public class Neo4jBenchmark {
7272
public static void main(String[] args) throws IOException {
7373

7474
loadGraph(args[6], Integer.parseInt(args[1]), args[4], args[0]);
75-
//benchmark(args[0], Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3]), args[5], args[6], args[7], args[4]);
76-
benchmarkReachabilities(args[0], Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3]), args[5], args[6], args[7], args[4]);
75+
benchmark(args[0], Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3]), args[5], args[6], args[7], args[4]);
76+
//benchmarkReachabilities(args[0], Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3]), args[5], args[6], args[7], args[4]);
7777
removeData();
7878
managementService.shutdown();
7979
}
@@ -277,83 +277,6 @@ public static void loadGraph(String dataset, int nodeNumber, String pathToDatas
277277
}
278278

279279
public static void benchmarkReachabilities(String relType, int nodeNumber, int warmUp, int maxIter, String pathToGrammar, String dataset, String grammarName, String pathToDataset) throws IOException {
280-
BiFunction<Relationship, Direction, String> f = getFunction(relType);
281-
Grammar grammar;
282-
try {
283-
grammar = Grammar.load(pathToGrammar, "json");
284-
} catch (FileNotFoundException e) {
285-
throw new RuntimeException("No grammar.json file is present");
286-
}
287-
List<Integer> vertices = new ArrayList<>();
288-
try (Stream<String> inputNodes = Files.lines(Paths.get("/" + pathToDataset + dataset + "_all_nodes.csv"))) {
289-
inputNodes.forEach(node -> {
290-
vertices.add(Integer.parseInt(node));
291-
});
292-
}
293-
294-
List<Tuple<Integer, Integer>> chunkSize = Arrays.asList(
295-
// new Tuple<>(nodeNumber, 100)
296-
new Tuple<>(1, 100)
297-
//, new Tuple<>(10, 20)
298-
//, new Tuple<>(50, 30)
299-
//, new Tuple<>(100, 50)
300-
//, new Tuple<>(500, 70)
301-
// new Tuple<>(1000, 10)
302-
//, new Tuple<>(5000, 100)
303-
//, new Tuple<>(10000, 100)
304-
);
305-
for (Tuple<Integer, Integer> sz : chunkSize) {
306-
List<List<Integer>> verticesPartitioned = Lists.partition(vertices.subList(0, vertices.size() * sz.getSecond() / 100), sz.getFirst());
307-
Files.createDirectories(Paths.get("results/" + dataset + "/" + grammarName));
308-
PrintWriter resulTimePerChunk = new PrintWriter("results/" + dataset + "/" + grammarName + "/" + "chunkSize_" + sz.getFirst() + ".txt");
309-
// PrintWriter bigResulTimePerChunk = new PrintWriter("results/" + dataset + "/" + grammarName + "/" + "chunkSize_" + sz.getFirst() + "_big.txt");
310-
for (int iter = 0; iter < maxIter; ++iter) {
311-
IguanaParser parser = new IguanaParser(grammar);
312-
long t1 = System.nanoTime();
313-
// if (iter >= warmUp) {
314-
// resulTimePerChunk.print(iter - warmUp + 1);
315-
//}
316-
int finalIter = iter;
317-
verticesPartitioned.forEach(chunk -> {
318-
GraphInput input = new Neo4jBenchmarkInput(graphDb, f, chunk.stream(), nodeNumber);
319-
//System.out.println("iteration: " + finalIter + " first vertex: " + chunk);
320-
long result = 0;
321-
long t1_local = System.nanoTime();
322-
Stream<Pair> parseResults = parser.getReachabilities(input,
323-
new ParseOptions.Builder().setAmbiguous(false).build());
324-
if (parseResults != null) {
325-
result = parseResults.count();
326-
}
327-
long t2_local = System.nanoTime();
328-
long stepTime = t2_local - t1_local;
329-
if (finalIter >= warmUp) {
330-
resulTimePerChunk.println(stepTime);
331-
}
332-
System.out.println(" time: " + stepTime + "\n" + "result: " + result);
333-
334-
// if (stepTime > 1000000000) {
335-
// resulTimePerChunk.println(chunk.get(0) + "," + stepTime);
336-
//}
337-
((Neo4jBenchmarkInput) input).close();
338-
339-
System.out.println(" time: " + stepTime + "\n" + "ans:" + result);
340-
// }
341-
((Neo4jBenchmarkInput) input).close();
342-
// }
343-
gc();
344-
});
345-
long t2 = System.nanoTime();
346-
// if (iter >= warmUp) {
347-
// resulTimePerChunk.print(iter - warmUp + 1);
348-
// chunkTime.forEach(x -> resulTimePerChunk.print("," + x));
349-
// resulTimePerChunk.println();
350-
//}
351-
// System.out.println("Total time: " + (t2 - t1));
352-
//Runtime.getRuntime().gc();
353-
}
354-
resulTimePerChunk.close();
355-
// bigResulTimePerChunk.close();
356-
}
357280
}
358281

359282
public static void benchmark(String relType, int nodeNumber, int warmUp, int maxIter, String pathToGrammar, String dataset, String grammarName, String pathToDataset) throws IOException {

0 commit comments

Comments
 (0)