Skip to content

Commit 4854c23

Browse files
committed
clean up
1 parent d1e0c6a commit 4854c23

14 files changed

Lines changed: 71 additions & 256 deletions

src/test/java/benchmark/AddError.java

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/test/java/benchmark/AstPrinterBenchmark.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@
1414

1515
import java.util.concurrent.TimeUnit;
1616

17-
/**
18-
* See https://github.com/openjdk/jmh/tree/master/jmh-samples/src/main/java/org/openjdk/jmh/samples/ for more samples
19-
* on what you can do with JMH
20-
* <p>
21-
* You MUST have the JMH plugin for IDEA in place for this to work : https://github.com/artyushov/idea-jmh-plugin
22-
* <p>
23-
* Install it and then just hit "Run" on a certain benchmark method
24-
*/
2517
@Warmup(iterations = 2, time = 5)
2618
@Measurement(iterations = 3, time = 10)
2719
@Fork(3)

src/test/java/benchmark/ChainedInstrumentationBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import static graphql.schema.GraphQLObjectType.newObject;
3434

3535
@State(Scope.Benchmark)
36-
@BenchmarkMode(Mode.Throughput)
3736
@Warmup(iterations = 2, time = 5)
3837
@Measurement(iterations = 3)
3938
@Fork(3)
@@ -69,6 +68,7 @@ public void setUp() throws ExecutionException, InterruptedException {
6968
}
7069

7170
@Benchmark
71+
@BenchmarkMode(Mode.Throughput)
7272
public GraphQLSchema benchmarkInstrumentSchema() {
7373
return chainedInstrumentation.instrumentSchema(schema, parameters, instrumentationState);
7474
}

src/test/java/benchmark/SchemaBenchMark.java renamed to src/test/java/benchmark/CreateSchemaBenchmark.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,24 @@
1616

1717
import java.util.concurrent.TimeUnit;
1818

19-
/**
20-
* This benchmarks schema creation
21-
* <p>
22-
* See https://github.com/openjdk/jmh/tree/master/jmh-samples/src/main/java/org/openjdk/jmh/samples/ for more samples
23-
* on what you can do with JMH
24-
* <p>
25-
* You MUST have the JMH plugin for IDEA in place for this to work : https://github.com/artyushov/idea-jmh-plugin
26-
* <p>
27-
* Install it and then just hit "Run" on a certain benchmark method
28-
*/
2919
@Warmup(iterations = 2, time = 5)
3020
@Measurement(iterations = 3)
3121
@Fork(3)
32-
public class SchemaBenchMark {
22+
public class CreateSchemaBenchmark {
3323

3424
static String largeSDL = BenchmarkUtils.loadResource("large-schema-3.graphqls");
3525

3626
@Benchmark
3727
@BenchmarkMode(Mode.Throughput)
3828
@OutputTimeUnit(TimeUnit.MINUTES)
39-
public void benchMarkLargeSchemaCreate(Blackhole blackhole) {
29+
public void benchmarkLargeSchemaCreate(Blackhole blackhole) {
4030
blackhole.consume(createSchema(largeSDL));
4131
}
4232

4333
@Benchmark
4434
@BenchmarkMode(Mode.AverageTime)
4535
@OutputTimeUnit(TimeUnit.MILLISECONDS)
46-
public void benchMarkLargeSchemaCreateAvgTime(Blackhole blackhole) {
36+
public void benchmarkLargeSchemaCreateAvgTime(Blackhole blackhole) {
4737
blackhole.consume(createSchema(largeSDL));
4838
}
4939

src/test/java/benchmark/DFSelectionSetBenchmark.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.openjdk.jmh.annotations.Scope;
2222
import org.openjdk.jmh.annotations.Setup;
2323
import org.openjdk.jmh.annotations.State;
24-
import org.openjdk.jmh.annotations.Threads;
2524
import org.openjdk.jmh.annotations.Warmup;
2625
import org.openjdk.jmh.infra.Blackhole;
2726

@@ -65,10 +64,6 @@ public void setup() {
6564
}
6665

6766
@Benchmark
68-
@Warmup(iterations = 2)
69-
@Measurement(iterations = 5, time = 10)
70-
@Threads(1)
71-
@Fork(3)
7267
@BenchmarkMode(Mode.AverageTime)
7368
@OutputTimeUnit(TimeUnit.MILLISECONDS)
7469
public void benchMarkAvgTime(MyState myState, Blackhole blackhole) {
@@ -77,10 +72,6 @@ public void benchMarkAvgTime(MyState myState, Blackhole blackhole) {
7772
}
7873

7974
@Benchmark
80-
@Warmup(iterations = 2)
81-
@Measurement(iterations = 5, time = 10)
82-
@Threads(1)
83-
@Fork(3)
8475
@BenchmarkMode(Mode.Throughput)
8576
@OutputTimeUnit(TimeUnit.MILLISECONDS)
8677
public void benchMarkThroughput(MyState myState, Blackhole blackhole) {

src/test/java/benchmark/NQBenchmark1.java renamed to src/test/java/benchmark/ENFBenchmark1.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
@Warmup(iterations = 2, time = 5)
2626
@Measurement(iterations = 3)
2727
@Fork(3)
28-
public class NQBenchmark1 {
28+
public class ENFBenchmark1 {
2929

3030
@State(Scope.Benchmark)
3131
public static class MyState {
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package benchmark;
2+
3+
import graphql.execution.CoercedVariables;
4+
import graphql.language.Document;
5+
import graphql.normalized.ExecutableNormalizedOperation;
6+
import graphql.normalized.ExecutableNormalizedOperationFactory;
7+
import graphql.parser.Parser;
8+
import graphql.schema.GraphQLSchema;
9+
import graphql.schema.idl.SchemaGenerator;
10+
import org.openjdk.jmh.annotations.Benchmark;
11+
import org.openjdk.jmh.annotations.BenchmarkMode;
12+
import org.openjdk.jmh.annotations.Fork;
13+
import org.openjdk.jmh.annotations.Measurement;
14+
import org.openjdk.jmh.annotations.Mode;
15+
import org.openjdk.jmh.annotations.OutputTimeUnit;
16+
import org.openjdk.jmh.annotations.Scope;
17+
import org.openjdk.jmh.annotations.Setup;
18+
import org.openjdk.jmh.annotations.State;
19+
import org.openjdk.jmh.annotations.Warmup;
20+
21+
import java.util.concurrent.TimeUnit;
22+
23+
@State(Scope.Benchmark)
24+
@Warmup(iterations = 2, time = 5)
25+
@Measurement(iterations = 3)
26+
@Fork(3)
27+
public class ENFBenchmark2 {
28+
29+
@State(Scope.Benchmark)
30+
public static class MyState {
31+
32+
GraphQLSchema schema;
33+
Document document;
34+
35+
@Setup
36+
public void setup() {
37+
try {
38+
String schemaString = BenchmarkUtils.loadResource("large-schema-2.graphqls");
39+
schema = SchemaGenerator.createdMockedSchema(schemaString);
40+
41+
String query = BenchmarkUtils.loadResource("large-schema-2-query.graphql");
42+
document = Parser.parse(query);
43+
} catch (Exception e) {
44+
throw new RuntimeException(e);
45+
}
46+
}
47+
48+
}
49+
50+
@Benchmark
51+
@BenchmarkMode(Mode.AverageTime)
52+
@OutputTimeUnit(TimeUnit.MILLISECONDS)
53+
public ExecutableNormalizedOperation benchMarkAvgTime(MyState myState) {
54+
ExecutableNormalizedOperation executableNormalizedOperation = ExecutableNormalizedOperationFactory.createExecutableNormalizedOperation(myState.schema, myState.document, null, CoercedVariables.emptyVariables());
55+
// System.out.println("fields size:" + normalizedQuery.getFieldToNormalizedField().size());
56+
return executableNormalizedOperation;
57+
}
58+
59+
}

src/test/java/benchmark/NQExtraLargeBenchmark.java renamed to src/test/java/benchmark/ENFExtraLargeBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
@Warmup(iterations = 2, time = 5)
2626
@Measurement(iterations = 3)
2727
@Fork(3)
28-
public class NQExtraLargeBenchmark {
28+
public class ENFExtraLargeBenchmark {
2929

3030
@State(Scope.Benchmark)
3131
public static class MyState {

src/test/java/benchmark/GetterAccessBenchmark.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
import java.lang.reflect.Method;
1212
import java.util.function.Function;
1313

14-
@Warmup(iterations = 2, time = 5)
15-
@Measurement(iterations = 3)
14+
@Warmup(iterations = 2, time = 5, batchSize = 500)
15+
@Measurement(iterations = 3, batchSize = 500)
1616
@Fork(3)
1717
public class GetterAccessBenchmark {
1818

src/test/java/benchmark/ListBenchmark.java

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)