Add JMH benchmark infrastructure
Prior to this commit, the Spring Framework test suite would rely only on "Performance" tests associated with a specific CI build. As outlined in gh-24830, the way they're built and executed is not working well anymore. This commit introduces a new JMH benchmark infrastructure in the build. The goal here is not to run those benchmarks as part of a CI build, but rather provide a proper infrastructure for writing and locally running micro-benchmarks when working on specific optimizations. This commit adds and configures a Gradle JMH plugin to allow for JMH benchmark classes in Spring Framework modules (in `src/jmh/java` of each `spring-*` module). It's also relaxing the checkstyle rules for JMH classes, especially around Javadoc rules: this code is not meant to have Javadocs. Finally, this commit links to a new Wiki page on the project GitHub repository documenting the infrastructure and helping contributors to run and design benchmarks. See gh-24830
This commit is contained in:
parent
5de6ae6fca
commit
67547e61c6
|
@ -17,6 +17,10 @@ For access to artifacts or a distribution zip, see the [Spring Framework Artifac
|
|||
The Spring Framework maintains reference documentation ([published](https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/) and [source](src/docs/asciidoc)), Github [wiki pages](https://github.com/spring-projects/spring-framework/wiki), and an
|
||||
[API reference](https://docs.spring.io/spring-framework/docs/current/javadoc-api/). There are also [guides and tutorials](https://spring.io/guides) across Spring projects.
|
||||
|
||||
## Micro-Benchmarks
|
||||
|
||||
See the [Micro-Benchmarks](https://github.com/spring-projects/spring-framework/wiki/Micro-Benchmarks) Wiki page.
|
||||
|
||||
## Build from Source
|
||||
|
||||
See the [Build from Source](https://github.com/spring-projects/spring-framework/wiki/Build-from-Source) Wiki page and the [CONTRIBUTING.md](CONTRIBUTING.md) file.
|
||||
|
|
|
@ -7,6 +7,7 @@ plugins {
|
|||
id 'de.undercouch.download' version '4.0.4'
|
||||
id "io.freefair.aspectj" version '5.0.0' apply false
|
||||
id "com.github.ben-manes.versions" version '0.28.0'
|
||||
id "me.champeau.gradle.jmh" version "0.5.0" apply false
|
||||
}
|
||||
|
||||
ext {
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
apply plugin: 'org.springframework.build.compile'
|
||||
apply plugin: 'org.springframework.build.optional-dependencies'
|
||||
apply plugin: 'me.champeau.gradle.jmh'
|
||||
apply from: "$rootDir/gradle/publications.gradle"
|
||||
|
||||
dependencies {
|
||||
jmh 'org.openjdk.jmh:jmh-core:1.23'
|
||||
jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.23'
|
||||
jmh 'net.sf.jopt-simple:jopt-simple:4.6'
|
||||
}
|
||||
jmh {
|
||||
duplicateClassesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest.attributes["Implementation-Title"] = project.name
|
||||
manifest.attributes["Implementation-Version"] = project.version
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
<suppress files="[\\/]src[\\/](test|testFixtures)[\\/]java[\\/]org[\\/]springframework[\\/].+(Tests|Suite)" checks="IllegalImport" id="bannedJUnitJupiterImports" />
|
||||
<suppress files="[\\/]src[\\/](test|testFixtures)[\\/]java[\\/]" checks="SpringJUnit5" message="should not be public" />
|
||||
|
||||
<!-- JMH benchmarks -->
|
||||
<suppress files="[\\/]src[\\/]jmh[\\/]java[\\/]org[\\/]springframework[\\/]" checks="JavadocVariable|JavadocStyle" />
|
||||
|
||||
<!-- spring-beans -->
|
||||
<suppress files="TypeMismatchException" checks="MutableException"/>
|
||||
<suppress files="BeanCreationException" checks="MutableException"/>
|
||||
|
|
Loading…
Reference in New Issue