diff --git a/CHANGELOG.md b/CHANGELOG.md index ed93da4..4e28429 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,18 @@ This release brings several breaking changes. Please refer to [UPGRADE](UPGRADE.md) document for details. New features and notable changes: +- New experimental executor with improved performance (#314).
+It is a one-line switch: `GraphQL::useExperimentalExecutor()`.
+
+**Please try it and post your feedback at https://github.com/webonyx/graphql-php/issues/397** +(as it may become the default one in future) +
+
- Spec compliance: error category, debug information and extensions are displayed under `extensions` key - `AbstractValidationRule` renamed to `ValidationRule` (NS `GraphQL\Validator\Rules`) - `AbstractQuerySecurity` renamed to `QuerySecurityRule` (NS `GraphQL\Validator\Rules`) - `FindBreakingChanges` renamed to `BreakingChangesFinder` (NS `GraphQL\Utils`) -- Added ability to override standard types via `GraphQL::overrideStandardTypes(array $types)` +- Added ability to override standard types via `GraphQL::overrideStandardTypes(array $types)` (#401) #### v0.12.5 - Execution performance optimization for lists diff --git a/src/GraphQL.php b/src/GraphQL.php index 497745f..a9819be 100644 --- a/src/GraphQL.php +++ b/src/GraphQL.php @@ -10,6 +10,8 @@ use GraphQL\Executor\Executor; use GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter; use GraphQL\Executor\Promise\Promise; use GraphQL\Executor\Promise\PromiseAdapter; +use GraphQL\Executor\ReferenceExecutor; +use GraphQL\Experimental\Executor\CoroutineExecutor; use GraphQL\Language\AST\DocumentNode; use GraphQL\Language\Parser; use GraphQL\Language\Source; @@ -319,6 +321,22 @@ class GraphQL Executor::setPromiseAdapter($promiseAdapter); } + /** + * Experimental: Switch to the new executor + */ + public static function useExperimentalExecutor() + { + Executor::setImplementationFactory([CoroutineExecutor::class, 'create']); + } + + /** + * Experimental: Switch back to the default executor + */ + public static function useReferenceExecutor() + { + Executor::setImplementationFactory([ReferenceExecutor::class, 'create']); + } + /** * Returns directives defined in GraphQL spec *