Draft
Conversation
5c5d1e9 to 7893835 Compare Contributor
| henryiii#17 defers more imports to be 1.4x faster than this PR and 4x faster than upstream |
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.
This makes running
cibuildwheel --helporcibuildwheel --print-build-indentifiersaround 3-4x faster on Python 3.15a7 by making imports lazy. If usinguvon a first run (like withuvx), this likely is even more, since it doesn't pre-compile.pycfiles by default.I used my
flake8-lazypackage (post here) to come up with the__lazy_modules__lists, and GPT 5 (due to the 0x token usage) in VSCode's copilot to apply the lists to the files.I restoredI think it's fine, but #2799 and #2798 were exposed while trying this. Will minimize the diff after those.from __future__ import annotations, but maybe I didn't need to, since they are not resolved on 3.14+. I might try without too later.Edit: used the new
--applyfeature of flake8-lazy to create this instead.Here's the version with @hugovk's CPython fix (thanks to @hugovk!):