Skip to content

Conversation

@bbakerman
Copy link
Member

@bbakerman bbakerman commented Oct 5, 2022

This changes the ChainedInstrumentation so that if we have 1 instrumentation in the list (the most common case) then no object allocation need be done for that case. We handle zero instrumentations as well (albeit we dont expect that case often) and otherwise we do what we do today

This also creates a "performant" SimplePerformantInstrumentation which does NOT delegate back to the deprecated methods and hence does not incude a "newState" object allocation of the parameters.

    default InstrumentationContext<ExecutionResult> beginExecution(InstrumentationExecutionParameters parameters, InstrumentationState state) {
        return beginExecution(parameters.withNewState(state));
    }

eg its avoid the above where a new parameters object is allocated every time

So the bulk of the change is updating the existing instrumentations to use the new more performant base class. I have deprecated the old SimpleInstrumentation

@bbakerman bbakerman added this to the 20.0 milestone Oct 5, 2022
@bbakerman
Copy link
Member Author

Starting benchmark :

Benchmark                                      Mode  Cnt  Score   Error  Units
IntrospectionBenchmark.benchMarkIntrospection  avgt   15  0.608 ± 0.045   s/op

After this change

Benchmark                                      Mode  Cnt  Score   Error  Units
IntrospectionBenchmark.benchMarkIntrospection  avgt   15  0.564 ± 0.026   s/op

So it seems to be an ok improvement

…xt_allocation_if_one_instrumentation

# Conflicts:
#	src/test/groovy/graphql/execution/AsyncExecutionStrategyTest.groovy
#	src/test/groovy/graphql/execution/ExecutionStrategyExceptionHandlingEquivalenceTest.groovy
#	src/test/groovy/graphql/execution/ExecutionTest.groovy
#	src/test/groovy/graphql/execution/instrumentation/dataloader/DataLoaderDispatcherInstrumentationTest.groovy
@bbakerman bbakerman requested review from andimarek and dondonz and removed request for dondonz October 24, 2022 23:30
@bbakerman bbakerman merged commit 322ba6b into master Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants