-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove ClassGraph from computation of JavaSourceSet, include type to …
…GAV coordinate mappings (#4391) * Simplify JavaSourceSet calculation by removing ClassGraph. We've given up ever fully hydrating the type information in this marker, so the more advanced features of ClassGraph are unnecessary. * Include mappings of types -> gav and gav -> types to facilitate the authoring of recipes which eliminate unused dependencies. * Add benchmark comparing new and old JavaSourceSet implementations. * No static state --------- Co-authored-by: Jonathan Schnéider <[email protected]>
- Loading branch information
1 parent
299a1fd
commit 7d71f62
Showing
5 changed files
with
231 additions
and
90 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
rewrite-benchmarks/src/jmh/java/org/openrewrite/benchmarks/java/JavaSourceSetBenchmark.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,38 @@ | ||
package org.openrewrite.benchmarks.java; | ||
|
||
import org.openjdk.jmh.annotations.*; | ||
import org.openrewrite.java.JavaParser; | ||
import org.openrewrite.java.internal.JavaTypeCache; | ||
import org.openrewrite.java.marker.JavaSourceSet; | ||
|
||
import java.nio.file.Path; | ||
import java.util.List; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
@State(Scope.Benchmark) | ||
@Fork(1) | ||
@Measurement(iterations = 2) | ||
@Warmup(iterations = 2) | ||
@BenchmarkMode(Mode.SampleTime) | ||
@OutputTimeUnit(TimeUnit.SECONDS) | ||
@Threads(4) | ||
public class JavaSourceSetBenchmark { | ||
|
||
List<Path> classpath; | ||
|
||
@Setup | ||
public void setup() { | ||
classpath = JavaParser.runtimeClasspath(); | ||
} | ||
|
||
@Benchmark | ||
public void jarIOBenchmark() { | ||
JavaSourceSet.build("main", classpath); | ||
} | ||
|
||
@Benchmark | ||
public void classgraphBenchmark() { | ||
//noinspection deprecation | ||
JavaSourceSet.build("main", classpath, new JavaTypeCache(), false); | ||
} | ||
} |
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
Oops, something went wrong.