-
Notifications
You must be signed in to change notification settings - Fork 4
/
OntologyGraphBench.java
102 lines (87 loc) · 3.64 KB
/
OntologyGraphBench.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package org.monarchinitiative.phenol.io.benches;
import org.monarchinitiative.phenol.ontology.data.TermId;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
/**
* Benchmark different implementations of {@link org.monarchinitiative.phenol.graph.OntologyGraph}.
*/
@BenchmarkMode(Mode.Throughput)
@Warmup(iterations = 2)
public class OntologyGraphBench {
@Benchmark
public void poly_getParents(CsrPolyOntologyGraphSetup ontology, Blackhole blackhole) {
for (TermId termId : ontology.primaryTermIds) {
ontology.ontology.graph().getParents(termId, false)
.forEach(blackhole::consume);
}
}
@Benchmark
public void poly_getChildren(CsrPolyOntologyGraphSetup ontology, Blackhole blackhole) {
for (TermId termId : ontology.primaryTermIds) {
ontology.ontology.graph().getChildren(termId, false)
.forEach(blackhole::consume);
}
}
@Benchmark
public void poly_getAncestors(CsrPolyOntologyGraphSetup ontology, Blackhole blackhole) {
for (TermId termId : ontology.primaryTermIds) {
ontology.ontology.graph().getAncestors(termId, false)
.forEach(blackhole::consume);
}
}
@Benchmark
public void poly_getDescendants(CsrPolyOntologyGraphSetup ontology, Blackhole blackhole) {
for (TermId termId : ontology.primaryTermIds) {
ontology.ontology.graph().getDescendants(termId, false)
.forEach(blackhole::consume);
}
}
@Benchmark
public void mono_getParents(CsrMonoOntologyGraphSetup ontology, Blackhole blackhole) {
for (TermId termId : ontology.primaryTermIds) {
ontology.ontology.graph().getParents(termId, false)
.forEach(blackhole::consume);
}
}
@Benchmark
public void mono_getChildren(CsrMonoOntologyGraphSetup ontology, Blackhole blackhole) {
for (TermId termId : ontology.primaryTermIds) {
ontology.ontology.graph().getChildren(termId, false)
.forEach(blackhole::consume);
}
}
@Benchmark
public void mono_getAncestors(CsrMonoOntologyGraphSetup ontology, Blackhole blackhole) {
for (TermId termId : ontology.primaryTermIds) {
ontology.ontology.graph().getAncestors(termId, false)
.forEach(blackhole::consume);
}
}
@Benchmark
public void mono_getDescendants(CsrMonoOntologyGraphSetup ontology, Blackhole blackhole) {
for (TermId termId : ontology.primaryTermIds) {
ontology.ontology.graph().getDescendants(termId, false)
.forEach(blackhole::consume);
}
}
/*
# Run complete. Total time: 00:33:59
Commit 6a470a0f
Benchmark Mode Cnt Score Error Units
OntologyGraphBench.mono_getChildren thrpt 25 163.773 ± 11.709 ops/s
OntologyGraphBench.mono_getParents thrpt 25 149.663 ± 8.890 ops/s
OntologyGraphBench.poly_getChildren thrpt 25 134.231 ± 7.379 ops/s
OntologyGraphBench.poly_getParents thrpt 25 131.846 ± 5.647 ops/s
# Run complete. Total time: 00:48:00
Commit 474ffa74
Benchmark Mode Cnt Score Error Units
OntologyGraphBench.mono_getAncestors thrpt 25 43.154 ± 0.660 ops/s
OntologyGraphBench.mono_getChildren thrpt 25 555.751 ± 129.691 ops/s
OntologyGraphBench.mono_getDescendants thrpt 25 37.129 ± 0.921 ops/s
OntologyGraphBench.mono_getParents thrpt 25 568.041 ± 45.601 ops/s
OntologyGraphBench.poly_getAncestors thrpt 25 18.252 ± 0.686 ops/s
OntologyGraphBench.poly_getChildren thrpt 25 117.166 ± 16.093 ops/s
OntologyGraphBench.poly_getDescendants thrpt 25 31.324 ± 1.547 ops/s
OntologyGraphBench.poly_getParents thrpt 25 124.328 ± 14.620 ops/s
*/
}