forked from micronaut-projects/micronaut-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize annotation metadata resolution performance (micronaut-projec…
…ts#1717) * Optimize annotation metadata resolution performance * Revert Optional<Class<?>> change, optimize isPresent
- Loading branch information
1 parent
345362a
commit a9e5c3d
Showing
52 changed files
with
1,892 additions
and
236 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
plugins { | ||
id "me.champeau.gradle.jmh" version "0.4.8" | ||
} | ||
|
||
dependencies { | ||
annotationProcessor project(":inject-java") | ||
annotationProcessor project(":validation") | ||
compile project(":inject") | ||
compile project(":validation") | ||
compile project(":runtime") | ||
|
||
|
||
jmh 'org.openjdk.jmh:jmh-core:1.21' | ||
jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.21' | ||
} | ||
jmh { | ||
duplicateClassesStrategy = 'warn' | ||
warmupIterations = 2 | ||
iterations = 4 | ||
fork = 1 | ||
} |
4 changes: 4 additions & 0 deletions
4
benchmarks/src/jmh/java/io/micronaut/core/annotation/AnnotationValueBenchmark.java
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,4 @@ | ||
package io.micronaut.core.annotation; | ||
|
||
public class AnnotationValueBenchmark { | ||
} |
45 changes: 45 additions & 0 deletions
45
benchmarks/src/jmh/java/io/micronaut/core/convert/ConversionServiceBenchmark.java
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,45 @@ | ||
package io.micronaut.core.convert; | ||
|
||
import org.openjdk.jmh.annotations.Benchmark; | ||
import org.openjdk.jmh.annotations.Scope; | ||
import org.openjdk.jmh.annotations.Setup; | ||
import org.openjdk.jmh.annotations.State; | ||
import org.openjdk.jmh.runner.Runner; | ||
import org.openjdk.jmh.runner.RunnerException; | ||
import org.openjdk.jmh.runner.options.Options; | ||
import org.openjdk.jmh.runner.options.OptionsBuilder; | ||
|
||
import java.net.URI; | ||
|
||
@State(Scope.Benchmark) | ||
public class ConversionServiceBenchmark { | ||
|
||
ConversionService conversionService; | ||
|
||
@Setup | ||
public void prepare() { | ||
conversionService = ConversionService.SHARED; | ||
} | ||
|
||
@Benchmark | ||
public void convertCacheHit() { | ||
conversionService.convert("10", Integer.class); | ||
} | ||
|
||
@Benchmark | ||
public void convertCacheMiss() { | ||
conversionService.convert(URI.create("http://test.com"), Integer.class); | ||
} | ||
|
||
public static void main(String[] args) throws RunnerException { | ||
Options opt = new OptionsBuilder() | ||
.include(".*" + ConversionServiceBenchmark.class.getSimpleName() + ".*") | ||
.warmupIterations(3) | ||
.measurementIterations(5) | ||
.forks(1) | ||
// .jvmArgs("-agentpath:/Applications/YourKit-Java-Profiler-2018.04.app/Contents/Resources/bin/mac/libyjpagent.jnilib") | ||
.build(); | ||
|
||
new Runner(opt).run(); | ||
} | ||
} |
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
173 changes: 146 additions & 27 deletions
173
core/src/main/java/io/micronaut/core/annotation/AnnotationMetadata.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.