-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4fc4d7
commit be2a900
Showing
8 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import main.MainClass | ||
|
||
import scala.io.Source | ||
|
||
object Benchmark { | ||
def main(args: Array[String]): Unit = { | ||
if (args.length != 2) { | ||
System.exit(1) | ||
} | ||
val schemaPath = args(0) | ||
val instancePath = args(1) | ||
|
||
val schema = Source.fromFile(schemaPath).mkString | ||
val registryMap = Map.empty[String, String] | ||
|
||
val start = System.nanoTime() | ||
for (instance <- Source.fromFile(instancePath).getLines()) { | ||
val result = MainClass.validateInstance(schema, instance, registryMap) | ||
if (!result) { | ||
System.err.println("Invalid instance") | ||
System.exit(1) | ||
} | ||
} | ||
val finish = System.nanoTime() | ||
|
||
println((finish - start).toString) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM sbtscala/scala-sbt:eclipse-temurin-17.0.4_1.7.2_2.13.10 AS builder | ||
|
||
WORKDIR /app | ||
COPY Benchmark.scala /app | ||
COPY build.sbt /app | ||
COPY project /app/project | ||
RUN sbt assembly | ||
ENTRYPOINT ["java", "-jar", "/app/target/scala-2.13/benchmarkMjs.jar"] | ||
CMD [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name := "mjs-validator" | ||
|
||
ThisBuild / version := "1.0" | ||
ThisBuild / scalaVersion := "2.13.10" | ||
|
||
javacOptions ++= Seq("-source", "17", "-target", "17") | ||
|
||
resolvers += Resolver.mavenCentral | ||
|
||
libraryDependencies ++= Seq( | ||
"org.scala-lang" % "scala-library" % "2.13.10" | ||
) | ||
|
||
val mjsVersion = "v0.1.0" | ||
lazy val mjs = RootProject( | ||
uri(s"https://gitlab.lip6.fr/jsonschema/modernjsonschemavalidator.git#$mjsVersion") | ||
) | ||
lazy val benchmarkMjs = (project in file(".")).dependsOn(mjs) | ||
assembly / assemblyJarName := "benchmarkMjs.jar" | ||
assembly / packageOptions := Seq( | ||
Package.ManifestAttributes( | ||
"Main-Class" -> "Benchmark", | ||
"Implementation-Group" -> "org.up.mjs", | ||
"Implementation-Name" -> "mjs", | ||
"Implementation-Version" -> mjsVersion | ||
) | ||
) | ||
|
||
scalacOptions += "-Ymacro-annotations" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=1.9.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.5") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
grep '^val mjsVersion =' implementations/mjs/build.sbt | cut -d= -f2 | tr -d '" ' |