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

Fixed Style hash #2346

Merged
merged 7 commits into from
Jun 17, 2022
Merged

Fixed Style hash #2346

merged 7 commits into from
Jun 17, 2022

Conversation

willmcgugan
Copy link
Collaborator

Fixes a performance bug in the Style class.

Essentially the hash calculation was inconsistent. Things that were equal would sometimes have different hashes. I noticed this when adding lru_cache to Style.__add__. What should have been an easy win caused dramatically reduced performance, because it broken the mechanics of storing Styles in a dict.

The hashing is now in once place. It is also lazy, so the hash is stored the first time it is used.

@willmcgugan willmcgugan changed the title fix hash Fixed Style hash Jun 15, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jun 15, 2022

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 98.83721% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.71%. Comparing base (14d47c9) to head (3bc9b28).
Report is 1034 commits behind head on master.

Files with missing lines Patch % Lines
rich/style.py 95.83% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2346      +/-   ##
==========================================
- Coverage   98.88%   98.71%   -0.18%     
==========================================
  Files          73       73              
  Lines        7629     7761     +132     
==========================================
+ Hits         7544     7661     +117     
- Misses         85      100      +15     
Flag Coverage Δ
unittests 98.71% <98.83%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@willmcgugan willmcgugan marked this pull request as draft June 15, 2022 20:13
@willmcgugan willmcgugan requested review from darrenburns and olivierphi and removed request for olivierphi and darrenburns June 15, 2022 20:13
@willmcgugan willmcgugan marked this pull request as ready for review June 15, 2022 20:14
@willmcgugan willmcgugan marked this pull request as draft June 15, 2022 20:57
Copy link

@olivierphi olivierphi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🙂

@willmcgugan willmcgugan marked this pull request as ready for review June 17, 2022 09:49
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.

None yet

3 participants