-
Notifications
You must be signed in to change notification settings - Fork 840
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Validation] Parallelize validation rules.
This provides a performance improvement and simplification to the validator by providing two new generic visitor utilities. One for tracking a TypeInfo instance alongside a visitor instance, and another for stepping through multiple visitors in parallel. The two can be composed together. Rather than 23 passes of AST visitation with one rule each, this now performs one pass of AST visitation with 23 rules. Since visitation is costly but rules are inexpensive, this nets out to a much faster overall validation, especially noticable for very large queries. Commit: 957704188b0a103c5f2fe0ab99479267d5d1ae43 [9577041] Parents: 439a3e2f4f Author: Lee Byron <[email protected]> Date: 17 November 2015 at 12:33:54 PM SGT ---- [Validation] Memoize collecting variable usage. During multiple validation passes we need to know about variable usage within a de-fragmented operation. Memoizing this ensures each pass is O(N) - each fragment is no longer visited per operation, but once total. In doing so, `visitSpreadFragments` is no longer used, which will be cleaned up in a later PR Commit: 2afbff79bfd2b89f03ca7913577556b73980f974 [2afbff7] Parents: 88acc01b99 Author: Lee Byron <[email protected]> Date: 17 November 2015 at 9:54:30 AM SGT
- Loading branch information
Showing
7 changed files
with
536 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package type_info | ||
|
||
import ( | ||
"github.com/graphql-go/graphql/language/ast" | ||
) | ||
|
||
/** | ||
* TypeInfoI defines the interface for TypeInfo | ||
* Implementation | ||
*/ | ||
type TypeInfoI interface { | ||
Enter(node ast.Node) | ||
Leave(node ast.Node) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.