-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Test] Perf test dump #3954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[Test] Perf test dump #3954
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,4 +54,3 @@ jar { | |
| ) | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,3 +122,4 @@ tasks.withType(GenerateModuleMetadata) { | |
| enabled = false | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a particular reason for updating Gradle in this PR? |
||
| networkTimeout=10000 | ||
| validateDistributionUrl=true | ||
| zipStoreBase=GRADLE_USER_HOME | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,248 @@ | ||
| package performance; | ||
|
|
||
| import graphql.language.AstPrinter; | ||
| import graphql.language.Document; | ||
| import graphql.parser.Parser; | ||
| import org.openjdk.jmh.annotations.Benchmark; | ||
| import org.openjdk.jmh.annotations.BenchmarkMode; | ||
| import org.openjdk.jmh.annotations.Fork; | ||
| import org.openjdk.jmh.annotations.Measurement; | ||
| import org.openjdk.jmh.annotations.Mode; | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit; | ||
| import org.openjdk.jmh.annotations.Warmup; | ||
| import org.openjdk.jmh.infra.Blackhole; | ||
|
|
||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| @Warmup(iterations = 2, time = 5) | ||
| @Measurement(iterations = 3, time = 10) | ||
| @Fork(3) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something I will later add as an ArchUnit test, we usually have 2 forks in GraphQL Java JMH tests to keep the running time shorter |
||
| public class AstPrinterPerformance { | ||
| /** | ||
| * Note: this query is a redacted version of a real query | ||
| */ | ||
| private static final Document document = Parser.parse("query fang($slip: dinner!) {\n" + | ||
| " instinctive(thin: $slip) {\n" + | ||
| " annoy {\n" + | ||
| " ...account\n" + | ||
| " }\n" + | ||
| " massive {\n" + | ||
| " ...cellar\n" + | ||
| " }\n" + | ||
| " used {\n" + | ||
| " ...rinse\n" + | ||
| " }\n" + | ||
| " distinct(sedate: [disarm]) {\n" + | ||
| " ...lamp\n" + | ||
| " }\n" + | ||
| " venomous {\n" + | ||
| " uninterested\n" + | ||
| " }\n" + | ||
| " correct {\n" + | ||
| " ...plane\n" + | ||
| " }\n" + | ||
| " drown\n" + | ||
| " talk {\n" + | ||
| " house\n" + | ||
| " womanly\n" + | ||
| " royal {\n" + | ||
| " ...snore\n" + | ||
| " }\n" + | ||
| " gray\n" + | ||
| " normal\n" + | ||
| " proud\n" + | ||
| " crate\n" + | ||
| " billowy {\n" + | ||
| " frogs\n" + | ||
| " abstracted\n" + | ||
| " market\n" + | ||
| " corn\n" + | ||
| " }\n" + | ||
| " tip {\n" + | ||
| " ...public\n" + | ||
| " }\n" + | ||
| " stick {\n" + | ||
| " ...precious\n" + | ||
| " }\n" + | ||
| " null {\n" + | ||
| " ...precious\n" + | ||
| " }\n" + | ||
| " }\n" + | ||
| " }\n" + | ||
| "}\n" + | ||
| "\n" + | ||
| "fragment account on bath {\n" + | ||
| " purpose\n" + | ||
| " festive\n" + | ||
| " ruddy\n" + | ||
| "}\n" + | ||
| "\n" + | ||
| "fragment cellar on thunder {\n" + | ||
| " debonair\n" + | ||
| " immense\n" + | ||
| " object\n" + | ||
| " moon\n" + | ||
| " icy {\n" + | ||
| " furniture\n" + | ||
| " historical\n" + | ||
| " team\n" + | ||
| " root\n" + | ||
| " }\n" + | ||
| "}\n" + | ||
| "\n" + | ||
| "fragment rinse on song {\n" + | ||
| " reply {\n" + | ||
| " sticks\n" + | ||
| " unbecoming\n" + | ||
| " }\n" + | ||
| " love {\n" + | ||
| " annoying\n" + | ||
| " sign\n" + | ||
| " }\n" + | ||
| "}\n" + | ||
| "\n" + | ||
| "fragment lamp on heartbreaking {\n" + | ||
| " innocent\n" + | ||
| " decorate\n" + | ||
| " pancake\n" + | ||
| " arithmetic\n" + | ||
| " grey\n" + | ||
| " brass\n" + | ||
| " pocket\n" + | ||
| "}\n" + | ||
| "\n" + | ||
| "fragment snore on tired {\n" + | ||
| " share\n" + | ||
| " baseball\n" + | ||
| " suspend\n" + | ||
| "}\n" + | ||
| "\n" + | ||
| "fragment settle on incompetent {\n" + | ||
| " name\n" + | ||
| " juggle\n" + | ||
| " depressed\n" + | ||
| "}\n" + | ||
| "\n" + | ||
| "fragment few on puffy {\n" + | ||
| " ticket\n" + | ||
| " puny\n" + | ||
| " copy\n" + | ||
| " coast\n" + | ||
| "}\n" + | ||
| "\n" + | ||
| "fragment plane on seat {\n" + | ||
| " ice\n" + | ||
| " mug\n" + | ||
| " wobble\n" + | ||
| " clear\n" + | ||
| " toys {\n" + | ||
| " ...few\n" + | ||
| " }\n" + | ||
| "}\n" + | ||
| "\n" + | ||
| "fragment public on basin {\n" + | ||
| " different\n" + | ||
| " fang\n" + | ||
| " slip\n" + | ||
| " dinner\n" + | ||
| " instinctive\n" + | ||
| " thin {\n" + | ||
| " annoy {\n" + | ||
| " account\n" + | ||
| " massive\n" + | ||
| " cellar\n" + | ||
| " used\n" + | ||
| " rinse {\n" + | ||
| " distinct\n" + | ||
| " }\n" + | ||
| " sedate {\n" + | ||
| " disarm\n" + | ||
| " }\n" + | ||
| " lamp {\n" + | ||
| " venomous\n" + | ||
| " }\n" + | ||
| " }\n" + | ||
| " uninterested {\n" + | ||
| " ...settle\n" + | ||
| " }\n" + | ||
| " }\n" + | ||
| "}\n" + | ||
| "\n" + | ||
| "fragment precious on drown {\n" + | ||
| " talk\n" + | ||
| " house\n" + | ||
| " womanly\n" + | ||
| " royal {\n" + | ||
| " snore {\n" + | ||
| " gray\n" + | ||
| " }\n" + | ||
| " normal {\n" + | ||
| " proud\n" + | ||
| " crate\n" + | ||
| " billowy\n" + | ||
| " frogs\n" + | ||
| " abstracted {\n" + | ||
| " ...snore\n" + | ||
| " }\n" + | ||
| " corn {\n" + | ||
| " tip\n" + | ||
| " public\n" + | ||
| " }\n" + | ||
| " stick {\n" + | ||
| " ...settle\n" + | ||
| " }\n" + | ||
| " null {\n" + | ||
| " ...few\n" + | ||
| " }\n" + | ||
| " marry\n" + | ||
| " bath {\n" + | ||
| " purpose\n" + | ||
| " festive\n" + | ||
| " }\n" + | ||
| " ruddy\n" + | ||
| " help\n" + | ||
| " thunder\n" + | ||
| " debonair {\n" + | ||
| " immense\n" + | ||
| " }\n" + | ||
| " object\n" + | ||
| " }\n" + | ||
| " }\n" + | ||
| "}"); | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.Throughput) | ||
| @OutputTimeUnit(TimeUnit.SECONDS) | ||
| public void benchMarkAstPrinterThroughput(Blackhole blackhole) { | ||
| printAst(blackhole); | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| public void benchMarkAstPrinterAvgTime(Blackhole blackhole) { | ||
| printAst(blackhole); | ||
| } | ||
|
|
||
| public static void printAst(Blackhole blackhole) { | ||
| blackhole.consume(AstPrinter.printAst(document)); | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.Throughput) | ||
| @OutputTimeUnit(TimeUnit.SECONDS) | ||
| public void benchMarkAstPrinterCompactThroughput(Blackhole blackhole) { | ||
| printAstCompact(blackhole); | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| public void benchMarkAstPrinterCompactAvgTime(Blackhole blackhole) { | ||
| printAstCompact(blackhole); | ||
| } | ||
|
|
||
| public static void printAstCompact(Blackhole blackhole) { | ||
| blackhole.consume(AstPrinter.printAstCompact(document)); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| package performance; | ||
|
|
||
| import benchmark.BenchmarkUtils; | ||
| import graphql.schema.GraphQLSchema; | ||
| import graphql.schema.idl.RuntimeWiring; | ||
| import graphql.schema.idl.SchemaGenerator; | ||
| import graphql.schema.idl.SchemaParser; | ||
| import graphql.schema.idl.TypeDefinitionRegistry; | ||
| import org.openjdk.jmh.annotations.Benchmark; | ||
| import org.openjdk.jmh.annotations.BenchmarkMode; | ||
| import org.openjdk.jmh.annotations.Fork; | ||
| import org.openjdk.jmh.annotations.Measurement; | ||
| import org.openjdk.jmh.annotations.Mode; | ||
| import org.openjdk.jmh.annotations.OutputTimeUnit; | ||
| import org.openjdk.jmh.annotations.Warmup; | ||
| import org.openjdk.jmh.infra.Blackhole; | ||
|
|
||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| @Warmup(iterations = 2, time = 5) | ||
| @Measurement(iterations = 3) | ||
| @Fork(3) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you change this to 2 forks please? |
||
| public class CreateSchemaPerformance { | ||
|
|
||
| static String largeSDL = BenchmarkUtils.loadResource("large-schema-3.graphqls"); | ||
| static String extraLargeSDL = BenchmarkUtils.loadResource("extra-large-schema-1.graphqls"); | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| public void benchmarkLargeSchemaCreateAvgTime(Blackhole blackhole) { | ||
| blackhole.consume(createSchema(largeSDL)); | ||
| } | ||
|
|
||
| @Benchmark | ||
| @BenchmarkMode(Mode.AverageTime) | ||
| @OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
| public void benchmarkExtraLargeSchemaCreateAvgTime(Blackhole blackhole) { | ||
| blackhole.consume(createSchema(extraLargeSDL)); | ||
| } | ||
|
|
||
| private static GraphQLSchema createSchema(String sdl) { | ||
| TypeDefinitionRegistry registry = new SchemaParser().parse(sdl); | ||
| return new SchemaGenerator().makeExecutableSchema(registry, RuntimeWiring.MOCKED_WIRING); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove
[Test]from the PR name to mark this as ready for review