Skip to content

Conversation

@melotic
Copy link
Member

@melotic melotic commented Mar 7, 2023

This adds caching to the PythonVersion class as profiling says this an incredibly expensive operation due to the amount of instances created and the expensive Regex. Testing with a small script on the data from our verification tests yields:

1317 of 1959 are duplicates
67.23% of the versions can be cached

Benchmarking on just the pip components from our verification tests with hyperfine shows notable performance gains:

Branch Mean [s] Min [s] Max [s] Relative
justinperez/pip-perf 5.106 ± 1.241 3.989 7.177 1.00
main 6.824 ± 1.101 4.267 8.765 1.34 ± 0.39

@melotic melotic requested a review from a team as a code owner March 7, 2023 17:13
@melotic melotic requested a review from JamieMagee March 7, 2023 17:13
@melotic melotic added type:refactor Refactoring or improving of existing code detector:pip The pip detector labels Mar 7, 2023
@melotic melotic force-pushed the justinperez/pip-perf branch from 5e22ddc to e8107c1 Compare March 7, 2023 20:05
@github-actions
Copy link

github-actions bot commented Mar 7, 2023

👋 Hi! It looks like you modified some files in the Detectors folder.
You may need to bump the detector versions if any of the following scenarios apply:

  • The detector detects more or fewer components than before
  • The detector generates different parent/child graph relationships than before
  • The detector generates different devDependencies values than before

If none of the above scenarios apply, feel free to ignore this comment 🙂

@melotic melotic merged commit 08f5b48 into main Mar 7, 2023
@melotic melotic deleted the justinperez/pip-perf branch March 7, 2023 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

detector:pip The pip detector type:refactor Refactoring or improving of existing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants