Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: cache requires-python checks & skip debug logging (#13128)
The requires-python check is pretty fast, but when performed for 10000 links, the checks consume a nontrivial amount of time. For example, while installing (pre-cached + --dry-run) a pared down list of homeassistant dependencies (n=117), link evaluation took 15% of the total runtime, with requires-python evaluation accounting for half (7.5%) of that. The cache can be kept pretty small as requires-python specifiers often repeat, and when they do change, it's often in chunks (or between entirely different packages). For example, setuptools has like 1500 links, but only ~12 different `requires-python` specifiers. In addition, _log_skipped_link() is a hot method and unfortunately expensive as it hashes the link on every call. Fortunately, we can return early when debug logging is not enabled. In the same homeassistant run, this saves 0.7% of the runtime.
- Loading branch information