-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
344 additions
and
7 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
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
Binary file not shown.
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 @@ | ||
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_linux-aarch64_bin.tar.gz |
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 @@ | ||
graalvm-ce-23.0.1-glibc |
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 @@ | ||
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_linux-x64_bin.tar.gz |
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 @@ | ||
graalvm-ce-23.0.1-glibc |
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 @@ | ||
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_linux-x64_bin.tar.gz |
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 @@ | ||
graalvm-ce-23.0.1-glibc |
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 @@ | ||
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_linux-aarch64_bin.tar.gz |
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 @@ | ||
graalvm-ce-23.0.1-musl |
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 @@ | ||
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_linux-x64_bin.tar.gz |
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 @@ | ||
graalvm-ce-23.0.1-musl |
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 @@ | ||
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_linux-x64_bin.tar.gz |
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 @@ | ||
graalvm-ce-23.0.1-musl |
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 @@ | ||
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_macos-aarch64_bin.tar.gz |
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 @@ | ||
graalvm-ce-23.0.1 |
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 @@ | ||
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_macos-x64_bin.tar.gz |
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 @@ | ||
graalvm-ce-23.0.1 |
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 @@ | ||
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_macos-x64_bin.tar.gz |
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 @@ | ||
graalvm-ce-23.0.1 |
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 @@ | ||
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_windows-aarch64_bin.zip |
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 @@ | ||
graalvm-ce-23.0.1 |
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 @@ | ||
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_windows-x64_bin.zip |
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 @@ | ||
graalvm-ce-23.0.1 |
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 @@ | ||
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-23.0.1/graalvm-community-jdk-23.0.1_windows-x64_bin.zip |
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 @@ | ||
graalvm-ce-23.0.1 |
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,26 @@ | ||
apply plugin: 'distribution' | ||
apply plugin: 'me.champeau.jmh' | ||
|
||
dependencies { | ||
jmhAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess' | ||
compileOnly 'org.openjdk.jmh:jmh-generator-annprocess' | ||
|
||
jmhImplementation 'org.assertj:assertj-core' | ||
jmhImplementation 'org.junit.jupiter:junit-jupiter' | ||
jmhImplementation 'org.openjdk.jmh:jmh-core' | ||
jmhImplementation 'org.openjdk.jmh:jmh-generator-annprocess' | ||
} | ||
|
||
tasks.withType(ProcessResources.class).configureEach { | ||
from(project(':palantir-java-format').tasks.named('fatJar')) { | ||
rename { 'palantir-java-format-all.jar' } | ||
} | ||
} | ||
|
||
jmhCompileGeneratedClasses { | ||
options.errorprone.enabled = false | ||
} | ||
|
||
tasks.named("jmh") { | ||
dependsOn ":palantir-java-format:nativeCompile", ":palantir-java-format:fatJar" | ||
} |
109 changes: 109 additions & 0 deletions
109
...ntir-java-format-benchmarks/src/jmh/java/com/palantir/javaformat/BenchmarkMultiFiles.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,109 @@ | ||
/* | ||
* (c) Copyright 2025 Palantir Technologies Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.palantir.javaformat; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.List; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
import org.openjdk.jmh.annotations.Benchmark; | ||
import org.openjdk.jmh.annotations.BenchmarkMode; | ||
import org.openjdk.jmh.annotations.Measurement; | ||
import org.openjdk.jmh.annotations.Mode; | ||
import org.openjdk.jmh.annotations.OutputTimeUnit; | ||
import org.openjdk.jmh.annotations.Scope; | ||
import org.openjdk.jmh.annotations.State; | ||
import org.openjdk.jmh.runner.Runner; | ||
import org.openjdk.jmh.runner.RunnerException; | ||
import org.openjdk.jmh.runner.options.OptionsBuilder; | ||
|
||
@Measurement(iterations = 2, time = 2) | ||
//@Warmup(iterations = 2, time = 4) | ||
public class BenchmarkMultiFiles { | ||
|
||
@State(Scope.Benchmark) | ||
public static class BenchmarkState { | ||
|
||
final List<String> filesToFormat = getFilesToFormat(); | ||
|
||
private static List<String> getFilesToFormat() { | ||
Path srcJavaFormatFiles = Paths.get(".") | ||
.toAbsolutePath() | ||
.resolve("../palantir-java-format/src/main/java/com/palantir/javaformat/java"); | ||
try (Stream<String> paths = Files.list(srcJavaFormatFiles) | ||
.filter(Files::isRegularFile) | ||
.map(path -> path.toAbsolutePath().toString())) { | ||
return paths.collect(Collectors.toList()); | ||
} catch (IOException e) { | ||
throw new RuntimeException("Couldn't list src files: " + srcJavaFormatFiles, e); | ||
} | ||
} | ||
} | ||
|
||
@Benchmark | ||
@BenchmarkMode(Mode.All) | ||
@OutputTimeUnit(TimeUnit.SECONDS) | ||
public final void runNativeImage(BenchmarkState state) throws InterruptedException, IOException { | ||
ProcessBuilder p = new ProcessBuilder(); | ||
p.command(Stream.concat( | ||
Stream.of( | ||
Path.of(".") | ||
.toAbsolutePath() | ||
.resolve("../palantir-java-format/build/graal/palantir-java-format") | ||
.toString(), | ||
"-i", | ||
"--palantir"), | ||
state.filesToFormat.stream()) | ||
.collect(Collectors.toList())); | ||
Process process = p.inheritIO().start(); | ||
assertThat(process.waitFor()).isEqualTo(0); | ||
} | ||
|
||
@Benchmark | ||
@BenchmarkMode(Mode.All) | ||
@OutputTimeUnit(TimeUnit.SECONDS) | ||
public final void runJar(BenchmarkState state) throws InterruptedException, IOException { | ||
ProcessBuilder p = new ProcessBuilder(); | ||
p.command(Stream.concat( | ||
Stream.of( | ||
"java", | ||
"-jar", | ||
Paths.get(".") | ||
.toAbsolutePath() | ||
.resolve("build/resources/jmh/palantir-java-format-all.jar") | ||
.toString(), | ||
"-i", | ||
"--palantir"), | ||
state.filesToFormat.stream()) | ||
.collect(Collectors.toList())); | ||
Process process = p.inheritIO().start(); | ||
assertThat(process.waitFor()).isEqualTo(0); | ||
} | ||
|
||
public static void main(String[] _args) throws RunnerException { | ||
new Runner(new OptionsBuilder() | ||
.include(BenchmarkMultiFiles.class.getSimpleName()) | ||
.build()) | ||
.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
18 changes: 18 additions & 0 deletions
18
palantir-java-format/src/main/resources/META-INF/native-image/jni-config.json
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,18 @@ | ||
[ | ||
{ | ||
"name":"com.palantir.javaformat.java.Main", | ||
"methods":[{"name":"main","parameterTypes":["java.lang.String[]"] }] | ||
}, | ||
{ | ||
"name":"java.lang.Boolean", | ||
"methods":[{"name":"getBoolean","parameterTypes":["java.lang.String"] }] | ||
}, | ||
{ | ||
"name":"java.lang.String", | ||
"methods":[{"name":"lastIndexOf","parameterTypes":["int"] }, {"name":"substring","parameterTypes":["int"] }] | ||
}, | ||
{ | ||
"name":"java.lang.System", | ||
"methods":[{"name":"getProperty","parameterTypes":["java.lang.String"] }, {"name":"setProperty","parameterTypes":["java.lang.String","java.lang.String"] }] | ||
} | ||
] |
8 changes: 8 additions & 0 deletions
8
palantir-java-format/src/main/resources/META-INF/native-image/predefined-classes-config.json
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,8 @@ | ||
[ | ||
{ | ||
"type":"agent-extracted", | ||
"classes":[ | ||
] | ||
} | ||
] | ||
|
2 changes: 2 additions & 0 deletions
2
palantir-java-format/src/main/resources/META-INF/native-image/proxy-config.json
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,2 @@ | ||
[ | ||
] |
50 changes: 50 additions & 0 deletions
50
palantir-java-format/src/main/resources/META-INF/native-image/reflect-config.json
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,50 @@ | ||
[ | ||
{ | ||
"name":"[Lcom.fasterxml.jackson.databind.deser.Deserializers;" | ||
}, | ||
{ | ||
"name":"[Lcom.fasterxml.jackson.databind.ser.BeanSerializerModifier;" | ||
}, | ||
{ | ||
"name":"[Lcom.fasterxml.jackson.databind.ser.Serializers;" | ||
}, | ||
{ | ||
"name":"com.fasterxml.jackson.databind.ext.Java7SupportImpl", | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
}, | ||
{ | ||
"name":"com.palantir.javaformat.java.JavacTokens$CommentSavingTokenizer" | ||
}, | ||
{ | ||
"name":"com.palantir.javaformat.java.java14.Java14InputAstVisitor", | ||
"methods":[{"name":"<init>","parameterTypes":["com.palantir.javaformat.OpsBuilder","int"] }] | ||
}, | ||
{ | ||
"name":"com.sun.source.tree.BindingPatternTree", | ||
"methods":[{"name":"getBinding","parameterTypes":[] }, {"name":"getType","parameterTypes":[] }, {"name":"getVariable","parameterTypes":[] }] | ||
}, | ||
{ | ||
"name":"com.sun.source.tree.CaseTree", | ||
"methods":[{"name":"getLabels","parameterTypes":[] }] | ||
}, | ||
{ | ||
"name":"com.sun.source.tree.ClassTree", | ||
"methods":[{"name":"getPermitsClause","parameterTypes":[] }] | ||
}, | ||
{ | ||
"name":"com.sun.source.tree.CompilationUnitTree", | ||
"methods":[{"name":"getModule","parameterTypes":[] }] | ||
}, | ||
{ | ||
"name":"com.sun.tools.javac.parser.JavaTokenizer", | ||
"fields":[{"name":"reader"}] | ||
}, | ||
{ | ||
"name":"com.sun.tools.javac.parser.UnicodeReader", | ||
"methods":[{"name":"getRawCharacters","parameterTypes":["int","int"] }] | ||
}, | ||
{ | ||
"name":"java.util.concurrent.atomic.AtomicReference", | ||
"fields":[{"name":"value"}] | ||
} | ||
] |
Oops, something went wrong.