From 54263d50c0848ee42e0c32eb9fd056ff9fa300b5 Mon Sep 17 00:00:00 2001 From: Vladimir Razuvaev Date: Tue, 27 Nov 2018 15:51:53 +0700 Subject: [PATCH] Added a note about experimental executor in the changelog --- CHANGELOG.md | 9 ++++++++- src/GraphQL.php | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) 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 *