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 repeated work in parallel visitor callbacks #296
ParallelVisitor rebuilds callback arguments and visitor indices during each node visit.
This adds overhead when many callbacks do little work.
Situation
Before
After
Change
GitHub schema, 25 empty parallel visitors
195.20 ms
94.48 ms
51.6% less time
GitHub schema validation
46.78 ms
44.11 ms
5.7% less time
Introspection query validation
2.552 ms
2.530 ms
Within measurement variation
GitHub schema, one empty visitor
14.28 ms
14.42 ms
Within measurement variation
The proposed change builds callback arguments once and stores indices with cached handlers.
It also skips action checks for None results while keeping callback order and behavior unchanged.
The full test suite passes: 3,613 passed, 18 skipped.
Measurements use CPython 3.12.13, Linux x86-64, and an AMD EPYC 9R14.
Both versions ran on the same isolated core with at least 50 rounds per case.
The base commit is f9bdf7c5c728a04bd3f27bfb8d394e9ac95751e2.
The large gain applies to empty callbacks; practical validation benefits are smaller.
Codex helped prepare and test the proposed change, with candidates tracked through Weco Observe.
We would welcome feedback on this small Python-specific change before opening a pull request.
Activity
[-]# Reduce repeated work in parallel visitor callbacks[/-][+]Reduce repeated work in parallel visitor callbacks[/+]Cito commentedon Nov 5, 2026
Closed via #297.