You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reduce AST visitor bookkeeping without changing traversal behavior #292
Walking the GitHub schema with empty visitor callbacks spends time creating stack entries and empty edit lists.
The same loop also repeats type checks and checks action values when callbacks return None.
The repository benchmarks show these median times for a local change:
Situation
Before
After
Change
GitHub schema, one visitor
25.01 ms
14.75 ms
41.0% less time
GitHub schema, 25 parallel visitors
178.03 ms
171.57 ms
3.6% less time
Large query pickle decoding
17.17 ms
17.13 ms
No measurable change (0.2% less)
The parallel visitor case has a smaller gain because it spends more time in callbacks.
Pickle decoding does not use visit and shows no measurable change.
The proposed change uses plain tuple stack entries and creates edit lists only when needed.
It also reuses array state and skips action checks after None results.
The proposal keeps callback order, callback arguments, and immutable edit behavior unchanged.
This is Python-specific bookkeeping, with no new GraphQL behavior or API changes.
The complete native test suite passed: 3,610 tests, with 18 skipped.
Ruff and mypy passed for the changed module.
Environment: base commit 679be84cb93e421b04aee4a1b8f7ada34aed7d49, CPython 3.12.13, Linux x86-64, AMD EPYC 9R14.
Measurements used pytest 9.0.2 and pytest-benchmark 5.3.0, with at least 50 rounds per case on one isolated slot.
changed the title [-]# Reduce AST visitor bookkeeping without changing traversal behavior[/-][+]Reduce AST visitor bookkeeping without changing traversal behavior[/+]on Nov 1, 2026
Activity
[-]# Reduce AST visitor bookkeeping without changing traversal behavior[/-][+]Reduce AST visitor bookkeeping without changing traversal behavior[/+]Cito commentedon Nov 1, 2026
Fixed as proposed in #293.