Skip to content

Commit 6e52ed0

Browse files
committed
Convert AST nodes to frozen dataclasses (70% faster decode, 40% faster parsing)
Refactor all of the GraphQL AST Nodes to use Python dataclasses to provide better type safety, immutability guarantees, and cleaner code while maintaining backwards compatibility with existing APIs. Benchmark comparison (837f604 base vs dataclasses): | Benchmark | Base | Dataclass | Change | |---------------------------------|--------|------------|-----------------| | test_parse_large_query | 33,108 | 18,689 | 44% faster | | test_parse_kitchen_sink | 577 | 361 | 37% faster | | test_pickle_large_query_decode | 18,520 | 5,549 | 70% faster (3x) | | test_pickle_large_query_encode | 9,038 | 4,117 | 54% faster (2x) | | test_pickle_large_query_round | 28,048 | 10,206 | 64% faster (3x) | | test_many_repeated_fields | 15,918 | 14,909 | 6% faster | | test_execute_basic_sync | 310 | 292 | 6% faster | | test_execute_basic_async | 354 | 338 | 5% faster |
1 parent 505d347 commit 6e52ed0

5 files changed

Lines changed: 355 additions & 328 deletions

File tree

0 commit comments

Comments
 (0)