Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance: fix a performance regression introduced in #402 #582

Merged

Conversation

radoering
Copy link
Member

Fixes a perfomance regression introduced in #402 by applying cached_property to certain properties

cached_property is available since Python 3.8. There is a package named backports.cached-property, which makes the decorator available in Python 3.7. However, I don't want to add a new vendored dependency since we will drop Python 3.7 support anyway in the near future. We could introduce a restricted dependency on backports.cached-property like in poetry or just accept the performance regression for Python 3.7. I have chosen the latter but do not have strong feelings about it.

In the following table you can see the cumtime of relevant calls (in seconds) from profiling different variants for a sample project

variant excludes_single_version() VersionUnion.allows() VersionRangeConstraint.allowed_min
poetry master 2.2 0.3 -
poetry master with poetry-core master 15.3 12.4 7.7
poetry master with this PR 1.0 0.65 0.1

@radoering radoering requested a review from a team May 11, 2023 18:41
@radoering radoering force-pushed the pypa-packaging-compliance-performance branch from d15103b to 19492bb Compare May 11, 2023 19:33
@sonarcloud
Copy link

sonarcloud bot commented May 11, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@radoering radoering merged commit f93c93a into python-poetry:main May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants