Skip to content

Commit

Permalink
#1441 benchmark
Browse files Browse the repository at this point in the history
Signed-off-by: Håvard Ottestad <hmottestad@gmail.com>
  • Loading branch information
hmottestad committed Jul 5, 2019
1 parent 3287733 commit 8f40ea0
Show file tree
Hide file tree
Showing 10 changed files with 56,859 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ dependency-reduced-pom.xml
**/nb-configuration.xml
**/nbactions*.xml
*.jfr
compliance/repository/overlays
51 changes: 51 additions & 0 deletions compliance/model/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>rdf4j-compliance</artifactId>
<groupId>org.eclipse.rdf4j</groupId>
<version>2.5-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>rdf4j-model-compliance</artifactId>

<name>RDF4J Model compliance tests</name>

<dependencies>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>1.19</version>
<scope>test</scope>
</dependency>


<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>1.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rdf4j-model</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rdf4j-rio-api</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rdf4j-rio-turtle</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package org.eclipse.rdf4j.model.util;

import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.rio.RDFFormat;
import org.eclipse.rdf4j.rio.Rio;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;

import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.TimeUnit;

@State(Scope.Benchmark)
@Warmup(iterations = 20)
@BenchmarkMode({ Mode.AverageTime })
@Fork(value = 1, jvmArgs = { "-Xms1G", "-Xmx1G", "-XX:+UseSerialGC" })
//@Fork(value = 1, jvmArgs = {"-Xms8G", "-Xmx8G", "-XX:+UseSerialGC", "-XX:+UnlockCommercialFeatures", "-XX:StartFlightRecording=delay=5s,duration=120s,filename=recording.jfr,settings=profile", "-XX:FlightRecorderOptions=samplethreads=true,stackdepth=1024", "-XX:+UnlockDiagnosticVMOptions", "-XX:+DebugNonSafepoints"})
@Measurement(iterations = 10)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class IsomorphicBenchmark {

@Benchmark
public void blankNodes() throws IOException {

String name = "blankNodes.ttl";

Model m1 = getModel(name);
Model m2 = getModel(name);

Models.isomorphic(m1, m2);

}

@Benchmark
public void shacl() throws IOException {

String name = "shacl.ttl";

Model m1 = getModel(name);
Model m2 = getModel(name);

Models.isomorphic(m1, m2);

}

@Benchmark
public void longChain() throws IOException {

String name = "longChain.ttl";

Model m1 = getModel(name);
Model m2 = getModel(name);

Models.isomorphic(m1, m2);

}

@Benchmark
public void sparqlTestCase() throws IOException {

String name = "sparqlTestCase.ttl";

Model m1 = getModel(name);
Model m2 = getModel(name);

Models.isomorphic(m1, m2);

}

@Benchmark
public void bsbm() throws IOException {

String name = "bsbm-100.ttl";

Model m1 = getModel(name);
Model m2 = getModel(name);

Models.isomorphic(m1, m2);

}

@Benchmark
public void spinFullForwardchained() throws IOException {

String name = "spin-full-forwardchained.ttl";

Model m1 = getModel(name);
Model m2 = getModel(name);

Models.isomorphic(m1, m2);

}

private Model getModel(String name) throws IOException {
try (InputStream resourceAsStream = IsomorphicBenchmark.class.getClassLoader()
.getResourceAsStream("benchmark/" + name)) {
return Rio.parse(resourceAsStream, "http://example.com/", RDFFormat.TURTLE);
}
}

}
46 changes: 46 additions & 0 deletions compliance/model/src/test/resources/benchmark/blankNodes.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@base <http://example.com/ns> .
@prefix ex: <http://example.com/ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/>.

_:0 foaf:knows _:1.
_:1 foaf:knows _:2.
_:2 foaf:knows _:3.
_:3 foaf:knows _:4.
_:4 foaf:knows _:5.
_:5 foaf:knows _:6.
_:6 foaf:knows _:7.
_:7 foaf:knows _:8.
_:8 foaf:knows _:9.
_:9 foaf:knows _:0.



_:01 foaf:knows _:1.
_:11 foaf:knows _:2.
_:21 foaf:knows _:3.
_:31 foaf:knows _:4.
_:41 foaf:knows _:5.
_:51 foaf:knows _:6.
_:61 foaf:knows _:7.
_:71 foaf:knows _:8.
_:81 foaf:knows _:9.
_:91 foaf:knows _:0.

_:02 foaf:knows _:1.
_:12 foaf:knows _:2.
_:22 foaf:knows _:3.
_:32 foaf:knows _:4.
_:42 foaf:knows _:5.
_:52 foaf:knows _:6.
_:62 foaf:knows _:7.
_:72 foaf:knows _:8.
_:82 foaf:knows _:9.
_:92 foaf:knows _:0.



Loading

0 comments on commit 8f40ea0

Please sign in to comment.