Skip to content

use sets - #3546

Merged
willmcgugan merged 5 commits into
masterfrom
faster-cell-len
Nov 1, 2024
Merged

willmcgugan merged 5 commits into
masterfrom
faster-cell-len

Conversation

@willmcgugan

@willmcgugan willmcgugan commented Oct 31, 2024 •

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

@codecov-commenter

codecov-commenter commented Oct 31, 2024 •

Copy link
Copy Markdown

⚠️ 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
@willmcgugan
willmcgugan deleted the faster-cell-len branch November 1, 2024 15:31
@ofek

ofek commented Nov 1, 2024

Copy link
Copy Markdown
Contributor

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

willmcgugan commented Nov 1, 2024 •

Copy link
Copy Markdown
Member Author

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

ofek commented Nov 1, 2024

Copy link
Copy Markdown
Contributor

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