Skip to content

Commit a38de98

Browse files
authored
GH-5648 new benchmark module (#5651)
* create module * move common large benchmark files to the common module * clean up shared queries * data generator
1 parent fdfd45f commit a38de98

File tree

219 files changed

+5145
-5381483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+5145
-5381483
lines changed

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Evidence:
246246
Command: python3 .codex/skills/mvnf/scripts/mvnf.py Class#method (preferred) OR mvn -o -Dmaven.repo.local=.m2_repo -pl <module> -Dtest=Class#method verify
247247
Report: <module>/target/surefire-reports/<file>.txt
248248
Snippet:
249-
\<copy 10–30 lines capturing the failure or success summary>
249+
\<copy 1–30 lines capturing the failure or success summary>
250250
```
251251

252252
**Routine B additions**
@@ -429,6 +429,7 @@ Always keep untracked artifacts!
429429
3. **Migration/rename/autogen refresh** where behavior is already characterized by existing tests.
430430
4. **Build/CI/docs/logging/message changes** that do not alter runtime behavior or asserted outputs.
431431
5. **Data/resource tweaks** not asserted by tests and not affecting behavior.
432+
6. **Benchmark-only changes** (benchmark sources, harness scripts, or benchmark data) that do not alter production behavior.
432433
433434
### Routine B Gates (all must pass)
434435
- **Neutrality/Scope:** No externally observable behavior change. Localized edit.

compliance/model/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
<version>${jmhVersion}</version>
2222
<scope>test</scope>
2323
</dependency>
24+
<dependency>
25+
<groupId>${project.groupId}</groupId>
26+
<artifactId>rdf4j-benchmark-common</artifactId>
27+
<version>${project.version}</version>
28+
<scope>test</scope>
29+
</dependency>
2430
<dependency>
2531
<groupId>${project.groupId}</groupId>
2632
<artifactId>rdf4j-model-testsuite</artifactId>

compliance/model/src/test/java/org/eclipse/rdf4j/model/util/IsomorphicBenchmark.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*
99
* SPDX-License-Identifier: BSD-3-Clause
1010
*******************************************************************************/
11+
// Some portions generated by Codex
1112

1213
package org.eclipse.rdf4j.model.util;
1314

@@ -17,6 +18,7 @@
1718
import java.util.List;
1819
import java.util.concurrent.TimeUnit;
1920

21+
import org.eclipse.rdf4j.benchmark.common.BenchmarkResources;
2022
import org.eclipse.rdf4j.model.Model;
2123
import org.eclipse.rdf4j.model.Statement;
2224
import org.eclipse.rdf4j.model.impl.TreeModel;
@@ -55,15 +57,15 @@ public class IsomorphicBenchmark {
5557
private final Model longChain = getModel("longChain.ttl");
5658
private final Model sparqlTestCase = getModel("sparqlTestCase.ttl");
5759
private final Model spinFullForwardchained = getModel("spin-full-forwardchained.ttl");
58-
private final Model bsbm = getModel("bsbm-100.ttl");
59-
private final Model bsbmChanged = getModel("bsbm-100-changed.ttl");
60+
private final Model bsbm = getModel("bsbm-100.ttl.gz");
61+
private final Model bsbmChanged = getModel("bsbm-100-changed.ttl.gz");
6062
private final List<Statement> bsbm_arraylist = new ArrayList<>(bsbm);
6163
private final Model bsbmTree = new TreeModel(bsbm);
6264
private final Model list = getModel("list.ttl");
6365
private final Model internallyIsomorphic = getModel("internallyIsomorphic.ttl");
6466
private final Model manyProperties = getModel("manyProperties.ttl");
6567
private final Model manyProperties2 = getModel("manyProperties2.ttl");
66-
private final Model uuid = getModel("uuid.ttl");
68+
private final Model uuid = getModel("uuid.ttl.gz");
6769

6870
private final Model empty_2 = getModel("empty.ttl");
6971
private final Model blankNodes_2 = getModel("blankNodes.ttl");
@@ -74,14 +76,14 @@ public class IsomorphicBenchmark {
7476
private final Model longChain_2 = getModel("longChain.ttl");
7577
private final Model sparqlTestCase_2 = getModel("sparqlTestCase.ttl");
7678
private final Model spinFullForwardchained_2 = getModel("spin-full-forwardchained.ttl");
77-
private final Model bsbm_2 = getModel("bsbm-100.ttl");
79+
private final Model bsbm_2 = getModel("bsbm-100.ttl.gz");
7880
private final List<Statement> bsbm_arraylist_2 = new ArrayList<>(bsbm);
7981
private final Model bsbmTree_2 = new TreeModel(bsbm);
8082
private final Model list_2 = getModel("list.ttl");
8183
private final Model internallyIsomorphic_2 = getModel("internallyIsomorphic.ttl");
8284
private final Model manyProperties_2 = getModel("manyProperties.ttl");
8385
private final Model manyProperties2_2 = getModel("manyProperties2.ttl");
84-
private final Model uuid_2 = getModel("uuid.ttl");
86+
private final Model uuid_2 = getModel("uuid.ttl.gz");
8587

8688
public static void main(String[] args) throws RunnerException {
8789
Options opt = new OptionsBuilder().include("IsomorphicBenchmark.*")
@@ -275,9 +277,15 @@ public boolean bsbmNotIsomorphic() {
275277

276278
private Model getModel(String name) {
277279
try {
278-
try (InputStream resourceAsStream = IsomorphicBenchmark.class.getClassLoader()
279-
.getResourceAsStream("benchmarkFiles/" + name)) {
280-
return Rio.parse(resourceAsStream, "http://example.com/", RDFFormat.TURTLE);
280+
InputStream resourceAsStream;
281+
if (name.endsWith(".gz")) {
282+
resourceAsStream = BenchmarkResources.openDecompressedStream("benchmarkFiles/" + name);
283+
} else {
284+
resourceAsStream = IsomorphicBenchmark.class.getClassLoader()
285+
.getResourceAsStream("benchmarkFiles/" + name);
286+
}
287+
try (InputStream inputStream = resourceAsStream) {
288+
return Rio.parse(inputStream, "http://example.com/", RDFFormat.TURTLE);
281289
}
282290
} catch (IOException e) {
283291
throw new RuntimeException(e);

compliance/model/src/test/java/org/eclipse/rdf4j/model/util/IsomorphicTest.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*
99
* SPDX-License-Identifier: BSD-3-Clause
1010
*******************************************************************************/
11+
// Some portions generated by Codex
1112

1213
package org.eclipse.rdf4j.model.util;
1314

@@ -19,6 +20,7 @@
1920
import java.util.ArrayList;
2021
import java.util.List;
2122

23+
import org.eclipse.rdf4j.benchmark.common.BenchmarkResources;
2224
import org.eclipse.rdf4j.model.Model;
2325
import org.eclipse.rdf4j.model.Statement;
2426
import org.eclipse.rdf4j.model.impl.TreeModel;
@@ -67,8 +69,8 @@ public static void beforeClass() {
6769
longChain = getModel("longChain.ttl");
6870
sparqlTestCase = getModel("sparqlTestCase.ttl");
6971
spinFullForwardchained = getModel("spin-full-forwardchained.ttl");
70-
bsbm = getModel("bsbm-100.ttl");
71-
bsbmChanged = getModel("bsbm-100-changed.ttl");
72+
bsbm = getModel("bsbm-100.ttl.gz");
73+
bsbmChanged = getModel("bsbm-100-changed.ttl.gz");
7274
bsbm_arraylist = new ArrayList<>(bsbm);
7375
bsbmTree = new TreeModel(bsbm);
7476
list = getModel("list.ttl");
@@ -82,7 +84,7 @@ public static void beforeClass() {
8284
longChain_2 = getModel("longChain.ttl");
8385
sparqlTestCase_2 = getModel("sparqlTestCase.ttl");
8486
spinFullForwardchained_2 = getModel("spin-full-forwardchained.ttl");
85-
bsbm_2 = getModel("bsbm-100.ttl");
87+
bsbm_2 = getModel("bsbm-100.ttl.gz");
8688
bsbm_arraylist_2 = new ArrayList<>(bsbm);
8789
bsbmTree_2 = new TreeModel(bsbm);
8890
list_2 = getModel("list.ttl");
@@ -255,9 +257,15 @@ public void testIsomorphicDatatype() throws Exception {
255257

256258
private static Model getModel(String name) {
257259
try {
258-
try (InputStream resourceAsStream = IsomorphicTest.class.getClassLoader()
259-
.getResourceAsStream("benchmarkFiles/" + name)) {
260-
return Rio.parse(resourceAsStream, "http://example.com/", RDFFormat.TURTLE);
260+
InputStream resourceAsStream;
261+
if (name.endsWith(".gz")) {
262+
resourceAsStream = BenchmarkResources.openDecompressedStream("benchmarkFiles/" + name);
263+
} else {
264+
resourceAsStream = IsomorphicTest.class.getClassLoader()
265+
.getResourceAsStream("benchmarkFiles/" + name);
266+
}
267+
try (InputStream inputStream = resourceAsStream) {
268+
return Rio.parse(inputStream, "http://example.com/", RDFFormat.TURTLE);
261269
}
262270
} catch (IOException e) {
263271
throw new RuntimeException(e);

0 commit comments

Comments
 (0)