@@ -0,0 +1,3473 @@
+package benchmark;%0A%0Aimport com.google.common.base.Charsets;%0Aimport com.google.common.io.Resources;%0Aimport graphql.ExecutionResult;%0Aimport graphql.GraphQL;%0Aimport graphql.language.Document;%0Aimport graphql.parser.Parser;%0Aimport graphql.schema.GraphQLSchema;%0Aimport graphql.schema.idl.SchemaGenerator;%0Aimport graphql.validation.LanguageTraversal;%0Aimport graphql.validation.RulesVisitor;%0Aimport graphql.validation.ValidationContext;%0Aimport graphql.validation.ValidationError;%0Aimport graphql.validation.ValidationErrorCollector;%0Aimport graphql.validation.rules.OverlappingFieldsCanBeMerged;%0Aimport org.openjdk.jmh.annotations.Benchmark;%0Aimport org.openjdk.jmh.annotations.BenchmarkMode;%0Aimport org.openjdk.jmh.annotations.Fork;%0Aimport org.openjdk.jmh.annotations.Measurement;%0Aimport org.openjdk.jmh.annotations.Mode;%0Aimport org.openjdk.jmh.annotations.OutputTimeUnit;%0Aimport org.openjdk.jmh.annotations.Scope;%0Aimport org.openjdk.jmh.annotations.Setup;%0Aimport org.openjdk.jmh.annotations.State;%0Aimport org.openjdk.jmh.annotations.Threads;%0Aimport org.openjdk.jmh.annotations.Warmup;%0A%0Aimport java.io.IOException;%0Aimport java.net.URL;%0Aimport java.util.Collections;%0Aimport java.util.List;%0Aimport java.util.concurrent.TimeUnit;%0A%0Aimport static com.google.common.io.Resources.getResource;%0Aimport static graphql.Assert.assertTrue;%0A%0A@State(Scope.Benchmark)%0A@BenchmarkMode(Mode.AverageTime)%0A@Threads(1)%0A@Warmup(iterations = 2, time = 5)%0A@Measurement(iterations = 3, time = 10)%0A@Fork(3)%0A@OutputTimeUnit(TimeUnit.MILLISECONDS)%0Apublic class OverlappingFieldValidationBenchmark %7B%0A%0A    @State(Scope.Benchmark)%0A    public static class MyState %7B%0A%0A        GraphQLSchema schema;%0A        Document document;%0A%0A        @Setup%0A        public void setup() %7B%0A            try %7B%0A                String schemaString = readFromClasspath(%22large-schema-4.graphqls%22);%0A                String query = readFromClasspath(%22large-schema-4-query.graphql%22);%0A                schema = SchemaGenerator.createdMockedSchema(schemaString);%0A                document = Parser.parse(query);%0A%0A                // make sure this is a valid query overall%0A                GraphQL graphQL = GraphQL.newGraphQL(schema).build();%0A                ExecutionResult executionResult = graphQL.execute(query);%0A                assertTrue(executionResult.getErrors().size() == 0);%0A            %7D catch (Exception e) %7B%0A                System.out.println(e);%0A                throw new RuntimeException(e);%0A            %7D%0A        %7D%0A%0A        private String readFromClasspath(String file) throws IOException %7B%0A            URL url = getResource(file);%0A            return Resources.toString(url, Charsets.UTF_8);%0A        %7D%0A    %7D%0A%0A    @Benchmark%0A    public List%3CValidationError%3E overlappingFieldValidation(MyState myState) %7B%0A        return validateQuery(myState.schema, myState.document);%0A    %7D%0A%0A%0A    private List%3CValidationError%3E validateQuery(GraphQLSchema schema, Document document) %7B%0A        ValidationErrorCollector errorCollector = new ValidationErrorCollector();%0A        ValidationContext validationContext = new ValidationContext(schema, document);%0A        OverlappingFieldsCanBeMerged overlappingFieldsCanBeMerged = new OverlappingFieldsCanBeMerged(validationContext, errorCollector);%0A        LanguageTraversal languageTraversal = new LanguageTraversal();%0A        languageTraversal.traverse(document, new RulesVisitor(validationContext, Collections.singletonList(overlappingFieldsCanBeMerged)));%0A        return errorCollector.getErrors();%0A    %7D%0A%7D%0A

add benchmark for OverlappingFieldsCanBeMerged validation