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

use sets #3546

Merged
merged 5 commits into from
Nov 1, 2024
Merged

use sets #3546

merged 5 commits into from
Nov 1, 2024

Conversation

willmcgugan
Copy link
Collaborator

@willmcgugan willmcgugan commented Oct 31, 2024

  • Faster detection of single length widths
  • Faster sum by using map rather than a list expression

@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2024

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

Codecov Report

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

Project coverage is 98.25%. Comparing base (60f3b61) to head (02f3d14).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
rich/cells.py 90.00% 1 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3546      +/-   ##
==========================================
- Coverage   98.27%   98.25%   -0.02%     
==========================================
  Files          74       74              
  Lines        8096     8095       -1     
==========================================
- Hits         7956     7954       -2     
- Misses        140      141       +1     
Flag Coverage Δ
unittests 98.25% <90.00%> (-0.02%) ⬇️

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.

@willmcgugan willmcgugan merged commit 12301e3 into master Nov 1, 2024
21 checks passed
@willmcgugan willmcgugan deleted the faster-cell-len branch November 1, 2024 15:31
@ofek
Copy link
Contributor

ofek commented Nov 1, 2024

I would recommend lazily defining constants like that so import time is not affected, especially since that is critical for command line applications. See PEP 562 https://peps.python.org/pep-0562/

@willmcgugan
Copy link
Collaborator Author

willmcgugan commented Nov 1, 2024

Agree in principle, but this data is used by virtually anything Rich does. So it is always needed.

It also turns out that it is faster to compute this than import it. 0.11ms to compute version 0.39ms to import.

So on my Macbook at least, it is a win to compute it.

@ofek
Copy link
Contributor

ofek commented Nov 1, 2024

Definitely makes sense if it's used everywhere, thanks! I'm just always looking for ways to reduce the import time of Rich, currently I think it could be better but I haven't had much time to look into that.

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.

3 participants