Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
visitor: speed up visitInParallel by dropping support for unknown nodes
- Loading branch information
1 parent
0091421
commit 6e2e350
Showing
7 changed files
with
157 additions
and
102 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
const { parse } = require('graphql/language/parser.js'); | ||
const { visit } = require('graphql/language/visitor.js'); | ||
|
||
const { bigSchemaSDL } = require('./fixtures.js'); | ||
|
||
const documentAST = parse(bigSchemaSDL); | ||
|
||
const visitor = { | ||
enter() { | ||
/* do nothing */ | ||
}, | ||
leave() { | ||
/* do nothing */ | ||
}, | ||
}; | ||
|
||
module.exports = { | ||
name: 'Visit all AST nodes', | ||
count: 10, | ||
measure() { | ||
visit(documentAST, visitor); | ||
}, | ||
}; |
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,25 @@ | ||
'use strict'; | ||
|
||
const { parse } = require('graphql/language/parser.js'); | ||
const { visit, visitInParallel } = require('graphql/language/visitor.js'); | ||
|
||
const { bigSchemaSDL } = require('./fixtures.js'); | ||
|
||
const documentAST = parse(bigSchemaSDL); | ||
|
||
const visitors = new Array(50).fill({ | ||
enter() { | ||
/* do nothing */ | ||
}, | ||
leave() { | ||
/* do nothing */ | ||
}, | ||
}); | ||
|
||
module.exports = { | ||
name: 'Visit all AST nodes in parallel', | ||
count: 10, | ||
measure() { | ||
visit(documentAST, visitInParallel(visitors)); | ||
}, | ||
}; |
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
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
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