-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
65 lines (56 loc) · 2.17 KB
/
build.gradle
File metadata and controls
65 lines (56 loc) · 2.17 KB
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
plugins {
id 'java'
id 'me.champeau.jmh' version '0.7.3'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
jmh('com.manticore-projects.jsqlformatter:jsqlparser:5.3.218')
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
// ---------------------------------------------------------------------------
// jmhRun — the main benchmark task
//
// Runs ParseBenchmark.main() which discovers ALL queries dynamically
// (built-in + queries/*.sql) and passes them to JMH via OptionsBuilder.
// No Gradle MapProperty nonsense.
//
// ./gradlew jmhRun # all queries
// ./gradlew jmhRun -Pquery=hive_retention # single query
// ./gradlew jmhRun -PjmhFork=1 # fewer forks
// ---------------------------------------------------------------------------
tasks.register('jmhRun', JavaExec) {
group = 'benchmark'
description = 'Run JMH parse benchmarks with auto-discovered queries from queries/*.sql'
dependsOn 'jmhJar'
// Use the JMH fat JAR — it contains META-INF/BenchmarkList from the annotation processor
classpath = files(tasks.named('jmhJar'))
mainClass = 'net.sf.jsqlparser.benchmark.ParseBenchmark'
// Ensure results directory exists
doFirst {
file('build/results/jmh').mkdirs()
}
// Forward Gradle properties as system properties to ParseBenchmark.main()
systemProperty 'jmh.forks', project.findProperty('jmhFork') ?: '2'
systemProperty 'jmh.warmupIterations', project.findProperty('jmhWarmupIterations') ?: '3'
systemProperty 'jmh.iterations', project.findProperty('jmhIterations') ?: '5'
if (project.hasProperty('query')) {
systemProperty 'jmh.query', project.property('query')
}
jvmArgs = ['-Xms512m', '-Xmx2g']
}
// Quick ad-hoc benchmark (no JMH harness) — handy for fast iteration
tasks.register('quickBench', JavaExec) {
group = 'benchmark'
description = 'Run a quick best-of-N parse benchmark (no JMH). Use jmhRun for rigorous numbers.'
dependsOn 'jmhClasses'
classpath = sourceSets.jmh.runtimeClasspath
mainClass = 'net.sf.jsqlparser.benchmark.QuickBench'
jvmArgs = ['-Xms512m', '-Xmx2g']
}