Repository navigation
Parse PyPI Simple API JSON responses directly - #21040
Closed
charliermarsh wants to merge 2 commits into
Closed
charliermarsh wants to merge 2 commits into
charliermarsh wants to merge 2 commits into
Conversation
charliermarsh
temporarily deployed
to
automations
August 10, 2026 18:48 — with
GitHub Actions
Inactive
Merging this PR will not alter performance
Comparing Footnotes
|
charliermarsh
temporarily deployed
to
automations
August 10, 2026 19:19 — with
GitHub Actions
Inactive
Unable to generate the flame graphsThe performance report has correctly been generated, but there was an internal error while generating the flame graphs for this run. We're working on fixing the issue. Feel free to contact us on Discord or at [email protected] if the issue persists. |
Member
Author
|
I had Codex do this but I think in practice it doesn't really matter: 50ms would be a very good PyPI connection, and at that point with Jupyter this is only 0.2% faster. |
This branch was previously deployed
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.
Summary
PyPI Simple API project responses currently deserialize through Serde into an intermediate
Vec<PypiFileWire>before converting each entry intoPypiFile. For packages with thousands of distributions, that extra pass, generic JSON dispatch, and temporary string allocations make index decoding unnecessarily expensive.Parse ordinary unescaped responses directly into
PypiFile, borrowing JSON strings while parsing, retaining the existingrequires-pythoninterner, and recognizing the common single-SHA-256 hash representation. Continue parsing upload timestamps with Jiff. Inputs with escaped strings, unsupported representations, malformed syntax, or invalid UTF-8 fall back to the existingserde_jsonimplementation, preserving compatibility and diagnostics. Pyx, MessagePack, HTML, and root-index responses are unchanged.The parser matches Serde across 558 differential cases, including malformed inputs, metadata aliases, duplicate fields, ignored values, project statuses, timestamp edge cases, and shared
requires-pythonallocations; theuv-pypi-typesand registry-client tests, Clippy, and a mock-index installation also pass.Benchmarks
Medians from 101 warmed, randomized, paired measurements against captured PyPI Simple API responses. These measurements cover JSON parsing only, not complete uv command execution.
serde_json