Repository navigation
perf(print_schema): print descriptions without the AST printer - faster print_schema - #324
Merged
Merged
Conversation
Member
|
Thanks! I pushed a small follow-up: a conditional expression, plus a note to keep this in sync with print_string_value in the printer. |
Cito
approved these changes
Nov 17, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
print_description()now gives the description toprint_block_string()orprint_string()directly. Before, it made aStringValueNodeand calledprint_ast(), which runs the AST printer for one node. The output does not change.print_schemaof the GitHub schemaTime ratios (new/old) for
print_schemaof the GitHub schema: 0.60 on CPython 3.10, 0.62 on 3.14, 0.63 on 3.15, and 0.90-1.04 on PyPy 3.11 (4 runs).I measured no slowdown on schemas with no descriptions, short descriptions, control characters, long and multi-line descriptions, a schema from introspection, and
print_introspection_schema. I used 150-400 interleaved rounds (Apple M5). Import time did not change (30 rounds). I did not measure other architectures.Checks:
tox -e py310,py311,py312,py313,py314,py315,pypy311,ruff,mypy,docspasses.