Skip to content

Commit

Permalink
remove kotlinx, add memory measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
bachish committed May 31, 2024
1 parent 852f0d6 commit 6838763
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 30 deletions.
63 changes: 34 additions & 29 deletions benchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
java
kotlin("jvm") version "1.9.20"
id("org.jetbrains.kotlinx.benchmark") version "0.4.10"
kotlin("plugin.allopen") version "1.9.20"
id("me.champeau.jmh") version "0.7.2"
}

repositories {
Expand All @@ -23,42 +23,47 @@ dependencies {
implementation("org.antlr:antlr4:4.13.1")
}

fun getArgs(strFolder: String): Array<String> {
fun getArgs(strFolder: String): List<String> {
val resourcesDir = File(strFolder)
val files = resourcesDir.listFiles()!!
return files.map { it.toString() }.sorted().toTypedArray()
return files.map { it.toString() }.sorted().toList()
}
//benchmark{}
benchmark {
configurations {
named("main") {
val dataset = "dataset"
if (!hasProperty(dataset)) {
println("BENCHMARKS FAILED! Set dataset folder by property '$dataset'")
}
else{
param("fileName", *getArgs(property(dataset).toString()))
}
this.reportFormat = "csv"
iterations = 15
iterationTime = 1000
iterationTimeUnit = "ms"
warmups = 5
outputTimeUnit = "ms"
mode = "avgt"
val tools = "toolName"
if (hasProperty(tools)) {
println("Run benchmarks for: .*${property(tools)}.*")
include(".*${property(tools)}.*")
}
jmh {
duplicateClassesStrategy = DuplicatesStrategy.EXCLUDE
warmupIterations = 5
warmup = "1s"
iterations = 10
timeOnIteration = "2s"
verbosity = "EXTRA"
benchmarkMode.addAll("AverageTime")
failOnError = false
resultFormat = "CSV"
jvmArgs.addAll("-Xmx128g")
val buildDir = project.layout.buildDirectory.get().toString()
humanOutputFile = project.file("${buildDir}/reports/jmh/human.txt") // human-readable output file
resultsFile = project.file("${buildDir}/reports/jmh/results.txt") // results file
profilers = listOf("gc")

}

//configure files
val dataset = "dataset"
if (!hasProperty(dataset)) {
println("BENCHMARKS FAILED! Set dataset folder by property '$dataset'")
} else {
val params = objects.listProperty<String>().value(getArgs(property(dataset).toString()))
benchmarkParameters.put("fileName", params)
}
targets {
register("main")

//filter on tools
val tools = "toolName"
if (hasProperty(tools)) {
println("Run benchmarks for: .*${property(tools)}.*")
includes = listOf(".*${property(tools)}.*")
}

}


allOpen {
annotation("org.openjdk.jmh.annotations.State")
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RecoveryParserGenerator(grammarClazz: Class<*>, terminalsEnum: Class<*>) :
private fun generateMainLoopFunction(): FunSpec {
return FunSpec.builder(MAIN_PARSE_FUNC).addModifiers(KModifier.OVERRIDE).addParameter(
DESCRIPTOR, descriptorType
).addStatement("super.%L()", MAIN_PARSE_FUNC)
).addStatement("super.%L(%L)", MAIN_PARSE_FUNC, DESCRIPTOR)
.addStatement("%L.%L(this, %L)", recoveryEngineType, RECOVERY_METHOD_NAME, DESCRIPTOR).build()
}
override fun getParserClassName(): String {
Expand Down

0 comments on commit 6838763

Please sign in to comment.